github.com/anthropics/anthropic-sdk-go@v1.70.1/betamessage.go (about)

     1  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
     2  
     3  package anthropic
     4  
     5  import (
     6  	"context"
     7  	"encoding/json"
     8  	"fmt"
     9  	"net/http"
    10  	"slices"
    11  	"time"
    12  
    13  	"github.com/anthropics/anthropic-sdk-go/internal/apijson"
    14  	"github.com/anthropics/anthropic-sdk-go/internal/paramutil"
    15  	"github.com/anthropics/anthropic-sdk-go/internal/requestconfig"
    16  	"github.com/anthropics/anthropic-sdk-go/option"
    17  	"github.com/anthropics/anthropic-sdk-go/packages/param"
    18  	"github.com/anthropics/anthropic-sdk-go/packages/respjson"
    19  	"github.com/anthropics/anthropic-sdk-go/packages/ssestream"
    20  	"github.com/anthropics/anthropic-sdk-go/shared/constant"
    21  )
    22  
    23  // BetaMessageService contains methods and other services that help with
    24  // interacting with the anthropic API.
    25  //
    26  // Note, unlike clients, this service does not read variables from the environment
    27  // automatically. You should not instantiate this service directly, and instead use
    28  // the [NewBetaMessageService] method instead.
    29  type BetaMessageService struct {
    30  	Options []option.RequestOption
    31  	Batches BetaMessageBatchService
    32  }
    33  
    34  // NewBetaMessageService generates a new service that applies the given options to
    35  // each request. These options are applied after the parent client's options (if
    36  // there is one), and before any request-specific options.
    37  func NewBetaMessageService(opts ...option.RequestOption) (r BetaMessageService) {
    38  	r = BetaMessageService{}
    39  	r.Options = opts
    40  	r.Batches = NewBetaMessageBatchService(opts...)
    41  	return
    42  }
    43  
    44  // Send a structured list of input messages with text and/or image content, and the
    45  // model will generate the next message in the conversation.
    46  //
    47  // The Messages API can be used for either single queries or stateless multi-turn
    48  // conversations.
    49  //
    50  // Learn more about the Messages API in our
    51  // [user guide](https://platform.claude.com/docs/en/get-started)
    52  //
    53  // Note: If you choose to set a timeout for this request, we recommend 10 minutes.
    54  func (r *BetaMessageService) New(ctx context.Context, params BetaMessageNewParams, opts ...option.RequestOption) (res *BetaMessage, err error) {
    55  	for _, v := range params.Betas {
    56  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
    57  	}
    58  	if !param.IsOmitted(params.UserProfileID) {
    59  		opts = append(opts, option.WithHeader("anthropic-user-profile-id", fmt.Sprintf("%v", params.UserProfileID.Value)))
    60  	}
    61  	if !param.IsOmitted(params.WorkspaceID) {
    62  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", params.WorkspaceID.Value)))
    63  	}
    64  	opts = slices.Concat(r.Options, opts)
    65  	warnIfThinkingEnabled(params.Model, params.Thinking.OfEnabled != nil)
    66  
    67  	// For non-streaming requests, calculate the appropriate timeout based on maxTokens
    68  	// and check against model-specific limits
    69  	timeout, timeoutErr := CalculateNonStreamingTimeout(int(params.MaxTokens), params.Model, opts)
    70  	if timeoutErr != nil {
    71  		return nil, timeoutErr
    72  	}
    73  	opts = append(opts, option.WithRequestTimeout(timeout))
    74  
    75  	path := "v1/messages?beta=true"
    76  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  	if dest, ok := outputFormatDest(params); ok {
    81  		if parseErr := parseOutputContent(res, dest); parseErr != nil {
    82  			return res, parseErr
    83  		}
    84  	}
    85  	return res, err
    86  }
    87  
    88  // Send a structured list of input messages with text and/or image content, and the
    89  // model will generate the next message in the conversation.
    90  //
    91  // The Messages API can be used for either single queries or stateless multi-turn
    92  // conversations.
    93  //
    94  // Learn more about the Messages API in our
    95  // [user guide](https://platform.claude.com/docs/en/get-started)
    96  //
    97  // Note: If you choose to set a timeout for this request, we recommend 10 minutes.
    98  func (r *BetaMessageService) NewStreaming(ctx context.Context, params BetaMessageNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[BetaRawMessageStreamEventUnion]) {
    99  	var (
   100  		raw *http.Response
   101  		err error
   102  	)
   103  	for _, v := range params.Betas {
   104  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
   105  	}
   106  	if !param.IsOmitted(params.UserProfileID) {
   107  		opts = append(opts, option.WithHeader("anthropic-user-profile-id", fmt.Sprintf("%v", params.UserProfileID.Value)))
   108  	}
   109  	if !param.IsOmitted(params.WorkspaceID) {
   110  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", params.WorkspaceID.Value)))
   111  	}
   112  	opts = slices.Concat(r.Options, opts)
   113  	warnIfThinkingEnabled(params.Model, params.Thinking.OfEnabled != nil)
   114  	opts = append(opts, option.WithJSONSet("stream", true))
   115  	path := "v1/messages?beta=true"
   116  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
   117  	return ssestream.NewStream[BetaRawMessageStreamEventUnion](ssestream.NewDecoder(raw), err)
   118  }
   119  
   120  // Count the number of tokens in a Message.
   121  //
   122  // The Token Count API can be used to count the number of tokens in a Message,
   123  // including tools, images, and documents, without creating it.
   124  //
   125  // Learn more about token counting in our
   126  // [user guide](https://platform.claude.com/docs/en/build-with-claude/token-counting)
   127  func (r *BetaMessageService) CountTokens(ctx context.Context, params BetaMessageCountTokensParams, opts ...option.RequestOption) (res *BetaMessageTokensCount, err error) {
   128  	for _, v := range params.Betas {
   129  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
   130  	}
   131  	if !param.IsOmitted(params.UserProfileID) {
   132  		opts = append(opts, option.WithHeader("anthropic-user-profile-id", fmt.Sprintf("%v", params.UserProfileID.Value)))
   133  	}
   134  	if !param.IsOmitted(params.WorkspaceID) {
   135  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", params.WorkspaceID.Value)))
   136  	}
   137  	opts = slices.Concat(r.Options, opts)
   138  	path := "v1/messages/count_tokens?beta=true"
   139  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
   140  	return res, err
   141  }
   142  
   143  // Token usage for an advisor sub-inference iteration.
   144  type BetaAdvisorMessageIterationUsage struct {
   145  	// Breakdown of cached tokens by TTL
   146  	CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
   147  	// The number of input tokens used to create the cache entry.
   148  	CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
   149  	// The number of input tokens read from the cache.
   150  	CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
   151  	// The number of input tokens which were used.
   152  	InputTokens int64 `json:"input_tokens" api:"required"`
   153  	// The model that will complete your prompt.
   154  	//
   155  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
   156  	// details and options.
   157  	Model Model `json:"model" api:"required"`
   158  	// The number of output tokens which were used.
   159  	OutputTokens int64 `json:"output_tokens" api:"required"`
   160  	// Usage for an advisor sub-inference iteration
   161  	Type constant.AdvisorMessage `json:"type" default:"advisor_message"`
   162  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   163  	JSON struct {
   164  		CacheCreation            respjson.Field
   165  		CacheCreationInputTokens respjson.Field
   166  		CacheReadInputTokens     respjson.Field
   167  		InputTokens              respjson.Field
   168  		Model                    respjson.Field
   169  		OutputTokens             respjson.Field
   170  		Type                     respjson.Field
   171  		ExtraFields              map[string]respjson.Field
   172  		raw                      string
   173  	} `json:"-"`
   174  }
   175  
   176  // Returns the unmodified JSON received from the API
   177  func (r BetaAdvisorMessageIterationUsage) RawJSON() string { return r.JSON.raw }
   178  func (r *BetaAdvisorMessageIterationUsage) UnmarshalJSON(data []byte) error {
   179  	return apijson.UnmarshalRoot(data, r)
   180  }
   181  
   182  type BetaAdvisorRedactedResultBlock struct {
   183  	// Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect
   184  	// or modify.
   185  	EncryptedContent string `json:"encrypted_content" api:"required"`
   186  	// The advisor sub-inference's stop reason (same values as the top-level message
   187  	// `stop_reason`).
   188  	StopReason string                         `json:"stop_reason" api:"required"`
   189  	Type       constant.AdvisorRedactedResult `json:"type" default:"advisor_redacted_result"`
   190  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   191  	JSON struct {
   192  		EncryptedContent respjson.Field
   193  		StopReason       respjson.Field
   194  		Type             respjson.Field
   195  		ExtraFields      map[string]respjson.Field
   196  		raw              string
   197  	} `json:"-"`
   198  }
   199  
   200  // Returns the unmodified JSON received from the API
   201  func (r BetaAdvisorRedactedResultBlock) RawJSON() string { return r.JSON.raw }
   202  func (r *BetaAdvisorRedactedResultBlock) UnmarshalJSON(data []byte) error {
   203  	return apijson.UnmarshalRoot(data, r)
   204  }
   205  
   206  // The properties EncryptedContent, Type are required.
   207  type BetaAdvisorRedactedResultBlockParam struct {
   208  	// Opaque blob produced by a prior response; must be round-tripped verbatim.
   209  	EncryptedContent string            `json:"encrypted_content" api:"required"`
   210  	StopReason       param.Opt[string] `json:"stop_reason,omitzero"`
   211  	// This field can be elided, and will marshal its zero value as
   212  	// "advisor_redacted_result".
   213  	Type constant.AdvisorRedactedResult `json:"type" default:"advisor_redacted_result"`
   214  	paramObj
   215  }
   216  
   217  func (r BetaAdvisorRedactedResultBlockParam) MarshalJSON() (data []byte, err error) {
   218  	type shadow BetaAdvisorRedactedResultBlockParam
   219  	return param.MarshalObject(r, (*shadow)(&r))
   220  }
   221  func (r *BetaAdvisorRedactedResultBlockParam) UnmarshalJSON(data []byte) error {
   222  	return apijson.UnmarshalRoot(data, r)
   223  }
   224  
   225  type BetaAdvisorResultBlock struct {
   226  	// The advisor sub-inference's stop reason (same values as the top-level message
   227  	// `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the
   228  	// tool's `max_tokens` value or the advisor model's policy cap.
   229  	StopReason string                 `json:"stop_reason" api:"required"`
   230  	Text       string                 `json:"text" api:"required"`
   231  	Type       constant.AdvisorResult `json:"type" default:"advisor_result"`
   232  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   233  	JSON struct {
   234  		StopReason  respjson.Field
   235  		Text        respjson.Field
   236  		Type        respjson.Field
   237  		ExtraFields map[string]respjson.Field
   238  		raw         string
   239  	} `json:"-"`
   240  }
   241  
   242  // Returns the unmodified JSON received from the API
   243  func (r BetaAdvisorResultBlock) RawJSON() string { return r.JSON.raw }
   244  func (r *BetaAdvisorResultBlock) UnmarshalJSON(data []byte) error {
   245  	return apijson.UnmarshalRoot(data, r)
   246  }
   247  
   248  // The properties Text, Type are required.
   249  type BetaAdvisorResultBlockParam struct {
   250  	Text       string            `json:"text" api:"required"`
   251  	StopReason param.Opt[string] `json:"stop_reason,omitzero"`
   252  	// This field can be elided, and will marshal its zero value as "advisor_result".
   253  	Type constant.AdvisorResult `json:"type" default:"advisor_result"`
   254  	paramObj
   255  }
   256  
   257  func (r BetaAdvisorResultBlockParam) MarshalJSON() (data []byte, err error) {
   258  	type shadow BetaAdvisorResultBlockParam
   259  	return param.MarshalObject(r, (*shadow)(&r))
   260  }
   261  func (r *BetaAdvisorResultBlockParam) UnmarshalJSON(data []byte) error {
   262  	return apijson.UnmarshalRoot(data, r)
   263  }
   264  
   265  // The properties Model, Name, Type are required.
   266  type BetaAdvisorTool20260301Param struct {
   267  	// The model that will complete your prompt.
   268  	//
   269  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
   270  	// details and options.
   271  	Model Model `json:"model,omitzero" api:"required"`
   272  	// Bounds the advisor's total output (thinking + text) per call. When the advisor
   273  	// hits this cap, the returned advisor_result or advisor_redacted_result block
   274  	// carries stop_reason='max_tokens', and a truncation note is appended to the
   275  	// advice text the worker model sees (inside the encrypted blob in redacted mode).
   276  	// When set, the server also emits a remaining-tokens budget block in the advisor's
   277  	// prompt so the advisor self-shapes toward the cap. When omitted, the advisor
   278  	// model's default output cap applies and no budget block is emitted.
   279  	MaxTokens param.Opt[int64] `json:"max_tokens,omitzero"`
   280  	// Maximum number of times the tool can be used in the API request.
   281  	MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
   282  	// If true, tool will not be included in initial system prompt. Only loaded when
   283  	// returned via tool_reference from tool search.
   284  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
   285  	// When true, guarantees schema validation on tool names and inputs
   286  	Strict param.Opt[bool] `json:"strict,omitzero"`
   287  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
   288  	// "code_execution_20260521".
   289  	AllowedCallers []string `json:"allowed_callers,omitzero"`
   290  	// Create a cache control breakpoint at this content block.
   291  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
   292  	// Caching for the advisor's own prompt. When set, each advisor call writes a cache
   293  	// entry at the given TTL so subsequent calls in the same conversation read the
   294  	// stable prefix. When omitted, the advisor prompt is not cached.
   295  	Caching BetaCacheControlEphemeralParam `json:"caching,omitzero"`
   296  	// Name of the tool.
   297  	//
   298  	// This is how the tool will be called by the model and in `tool_use` blocks.
   299  	//
   300  	// This field can be elided, and will marshal its zero value as "advisor".
   301  	Name constant.Advisor `json:"name" default:"advisor"`
   302  	// This field can be elided, and will marshal its zero value as "advisor_20260301".
   303  	Type constant.Advisor20260301 `json:"type" default:"advisor_20260301"`
   304  	paramObj
   305  }
   306  
   307  func (r BetaAdvisorTool20260301Param) MarshalJSON() (data []byte, err error) {
   308  	type shadow BetaAdvisorTool20260301Param
   309  	return param.MarshalObject(r, (*shadow)(&r))
   310  }
   311  func (r *BetaAdvisorTool20260301Param) UnmarshalJSON(data []byte) error {
   312  	return apijson.UnmarshalRoot(data, r)
   313  }
   314  
   315  type BetaAdvisorToolResultBlock struct {
   316  	Content   BetaAdvisorToolResultBlockContentUnion `json:"content" api:"required"`
   317  	ToolUseID string                                 `json:"tool_use_id" api:"required"`
   318  	Type      constant.AdvisorToolResult             `json:"type" default:"advisor_tool_result"`
   319  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   320  	JSON struct {
   321  		Content     respjson.Field
   322  		ToolUseID   respjson.Field
   323  		Type        respjson.Field
   324  		ExtraFields map[string]respjson.Field
   325  		raw         string
   326  	} `json:"-"`
   327  }
   328  
   329  // Returns the unmodified JSON received from the API
   330  func (r BetaAdvisorToolResultBlock) RawJSON() string { return r.JSON.raw }
   331  func (r *BetaAdvisorToolResultBlock) UnmarshalJSON(data []byte) error {
   332  	return apijson.UnmarshalRoot(data, r)
   333  }
   334  
   335  // BetaAdvisorToolResultBlockContentUnion contains all possible properties and
   336  // values from [BetaAdvisorToolResultError], [BetaAdvisorResultBlock],
   337  // [BetaAdvisorRedactedResultBlock].
   338  //
   339  // Use the methods beginning with 'As' to cast the union to one of its variants.
   340  type BetaAdvisorToolResultBlockContentUnion struct {
   341  	// This field is from variant [BetaAdvisorToolResultError].
   342  	ErrorCode  BetaAdvisorToolResultErrorErrorCode `json:"error_code"`
   343  	Type       string                              `json:"type"`
   344  	StopReason string                              `json:"stop_reason"`
   345  	// This field is from variant [BetaAdvisorResultBlock].
   346  	Text string `json:"text"`
   347  	// This field is from variant [BetaAdvisorRedactedResultBlock].
   348  	EncryptedContent string `json:"encrypted_content"`
   349  	JSON             struct {
   350  		ErrorCode        respjson.Field
   351  		Type             respjson.Field
   352  		StopReason       respjson.Field
   353  		Text             respjson.Field
   354  		EncryptedContent respjson.Field
   355  		raw              string
   356  	} `json:"-"`
   357  }
   358  
   359  func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorToolResultError() (v BetaAdvisorToolResultError) {
   360  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   361  	return
   362  }
   363  
   364  func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorResultBlock() (v BetaAdvisorResultBlock) {
   365  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   366  	return
   367  }
   368  
   369  func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorRedactedResultBlock() (v BetaAdvisorRedactedResultBlock) {
   370  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   371  	return
   372  }
   373  
   374  // Returns the unmodified JSON received from the API
   375  func (u BetaAdvisorToolResultBlockContentUnion) RawJSON() string { return u.JSON.raw }
   376  
   377  func (r *BetaAdvisorToolResultBlockContentUnion) UnmarshalJSON(data []byte) error {
   378  	return apijson.UnmarshalRoot(data, r)
   379  }
   380  
   381  // The properties Content, ToolUseID, Type are required.
   382  type BetaAdvisorToolResultBlockParam struct {
   383  	Content   BetaAdvisorToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
   384  	ToolUseID string                                      `json:"tool_use_id" api:"required"`
   385  	// Create a cache control breakpoint at this content block.
   386  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
   387  	// This field can be elided, and will marshal its zero value as
   388  	// "advisor_tool_result".
   389  	Type constant.AdvisorToolResult `json:"type" default:"advisor_tool_result"`
   390  	paramObj
   391  }
   392  
   393  func (r BetaAdvisorToolResultBlockParam) MarshalJSON() (data []byte, err error) {
   394  	type shadow BetaAdvisorToolResultBlockParam
   395  	return param.MarshalObject(r, (*shadow)(&r))
   396  }
   397  func (r *BetaAdvisorToolResultBlockParam) UnmarshalJSON(data []byte) error {
   398  	return apijson.UnmarshalRoot(data, r)
   399  }
   400  
   401  // Only one field can be non-zero.
   402  //
   403  // Use [param.IsOmitted] to confirm if a field is set.
   404  type BetaAdvisorToolResultBlockParamContentUnion struct {
   405  	OfRequestAdvisorToolResultError     *BetaAdvisorToolResultErrorParam     `json:",omitzero,inline"`
   406  	OfRequestAdvisorResultBlock         *BetaAdvisorResultBlockParam         `json:",omitzero,inline"`
   407  	OfRequestAdvisorRedactedResultBlock *BetaAdvisorRedactedResultBlockParam `json:",omitzero,inline"`
   408  	paramUnion
   409  }
   410  
   411  func (u BetaAdvisorToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
   412  	return param.MarshalUnion(u, u.OfRequestAdvisorToolResultError, u.OfRequestAdvisorResultBlock, u.OfRequestAdvisorRedactedResultBlock)
   413  }
   414  func (u *BetaAdvisorToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
   415  	return apijson.UnmarshalRoot(data, u)
   416  }
   417  
   418  func (u *BetaAdvisorToolResultBlockParamContentUnion) asAny() any {
   419  	if !param.IsOmitted(u.OfRequestAdvisorToolResultError) {
   420  		return u.OfRequestAdvisorToolResultError
   421  	} else if !param.IsOmitted(u.OfRequestAdvisorResultBlock) {
   422  		return u.OfRequestAdvisorResultBlock
   423  	} else if !param.IsOmitted(u.OfRequestAdvisorRedactedResultBlock) {
   424  		return u.OfRequestAdvisorRedactedResultBlock
   425  	}
   426  	return nil
   427  }
   428  
   429  // Returns a pointer to the underlying variant's property, if present.
   430  func (u BetaAdvisorToolResultBlockParamContentUnion) GetErrorCode() *string {
   431  	if vt := u.OfRequestAdvisorToolResultError; vt != nil {
   432  		return (*string)(&vt.ErrorCode)
   433  	}
   434  	return nil
   435  }
   436  
   437  // Returns a pointer to the underlying variant's property, if present.
   438  func (u BetaAdvisorToolResultBlockParamContentUnion) GetText() *string {
   439  	if vt := u.OfRequestAdvisorResultBlock; vt != nil {
   440  		return &vt.Text
   441  	}
   442  	return nil
   443  }
   444  
   445  // Returns a pointer to the underlying variant's property, if present.
   446  func (u BetaAdvisorToolResultBlockParamContentUnion) GetEncryptedContent() *string {
   447  	if vt := u.OfRequestAdvisorRedactedResultBlock; vt != nil {
   448  		return &vt.EncryptedContent
   449  	}
   450  	return nil
   451  }
   452  
   453  // Returns a pointer to the underlying variant's property, if present.
   454  func (u BetaAdvisorToolResultBlockParamContentUnion) GetType() *string {
   455  	if vt := u.OfRequestAdvisorToolResultError; vt != nil {
   456  		return (*string)(&vt.Type)
   457  	} else if vt := u.OfRequestAdvisorResultBlock; vt != nil {
   458  		return (*string)(&vt.Type)
   459  	} else if vt := u.OfRequestAdvisorRedactedResultBlock; vt != nil {
   460  		return (*string)(&vt.Type)
   461  	}
   462  	return nil
   463  }
   464  
   465  // Returns a pointer to the underlying variant's property, if present.
   466  func (u BetaAdvisorToolResultBlockParamContentUnion) GetStopReason() *string {
   467  	if vt := u.OfRequestAdvisorResultBlock; vt != nil && vt.StopReason.Valid() {
   468  		return &vt.StopReason.Value
   469  	} else if vt := u.OfRequestAdvisorRedactedResultBlock; vt != nil && vt.StopReason.Valid() {
   470  		return &vt.StopReason.Value
   471  	}
   472  	return nil
   473  }
   474  
   475  type BetaAdvisorToolResultError struct {
   476  	// Any of "max_uses_exceeded", "prompt_too_long", "too_many_requests",
   477  	// "overloaded", "unavailable", "execution_time_exceeded", "model_not_found".
   478  	ErrorCode BetaAdvisorToolResultErrorErrorCode `json:"error_code" api:"required"`
   479  	Type      constant.AdvisorToolResultError     `json:"type" default:"advisor_tool_result_error"`
   480  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   481  	JSON struct {
   482  		ErrorCode   respjson.Field
   483  		Type        respjson.Field
   484  		ExtraFields map[string]respjson.Field
   485  		raw         string
   486  	} `json:"-"`
   487  }
   488  
   489  // Returns the unmodified JSON received from the API
   490  func (r BetaAdvisorToolResultError) RawJSON() string { return r.JSON.raw }
   491  func (r *BetaAdvisorToolResultError) UnmarshalJSON(data []byte) error {
   492  	return apijson.UnmarshalRoot(data, r)
   493  }
   494  
   495  type BetaAdvisorToolResultErrorErrorCode string
   496  
   497  const (
   498  	BetaAdvisorToolResultErrorErrorCodeMaxUsesExceeded       BetaAdvisorToolResultErrorErrorCode = "max_uses_exceeded"
   499  	BetaAdvisorToolResultErrorErrorCodePromptTooLong         BetaAdvisorToolResultErrorErrorCode = "prompt_too_long"
   500  	BetaAdvisorToolResultErrorErrorCodeTooManyRequests       BetaAdvisorToolResultErrorErrorCode = "too_many_requests"
   501  	BetaAdvisorToolResultErrorErrorCodeOverloaded            BetaAdvisorToolResultErrorErrorCode = "overloaded"
   502  	BetaAdvisorToolResultErrorErrorCodeUnavailable           BetaAdvisorToolResultErrorErrorCode = "unavailable"
   503  	BetaAdvisorToolResultErrorErrorCodeExecutionTimeExceeded BetaAdvisorToolResultErrorErrorCode = "execution_time_exceeded"
   504  	BetaAdvisorToolResultErrorErrorCodeModelNotFound         BetaAdvisorToolResultErrorErrorCode = "model_not_found"
   505  )
   506  
   507  // The properties ErrorCode, Type are required.
   508  type BetaAdvisorToolResultErrorParam struct {
   509  	// Any of "max_uses_exceeded", "prompt_too_long", "too_many_requests",
   510  	// "overloaded", "unavailable", "execution_time_exceeded", "model_not_found".
   511  	ErrorCode BetaAdvisorToolResultErrorParamErrorCode `json:"error_code,omitzero" api:"required"`
   512  	// This field can be elided, and will marshal its zero value as
   513  	// "advisor_tool_result_error".
   514  	Type constant.AdvisorToolResultError `json:"type" default:"advisor_tool_result_error"`
   515  	paramObj
   516  }
   517  
   518  func (r BetaAdvisorToolResultErrorParam) MarshalJSON() (data []byte, err error) {
   519  	type shadow BetaAdvisorToolResultErrorParam
   520  	return param.MarshalObject(r, (*shadow)(&r))
   521  }
   522  func (r *BetaAdvisorToolResultErrorParam) UnmarshalJSON(data []byte) error {
   523  	return apijson.UnmarshalRoot(data, r)
   524  }
   525  
   526  type BetaAdvisorToolResultErrorParamErrorCode string
   527  
   528  const (
   529  	BetaAdvisorToolResultErrorParamErrorCodeMaxUsesExceeded       BetaAdvisorToolResultErrorParamErrorCode = "max_uses_exceeded"
   530  	BetaAdvisorToolResultErrorParamErrorCodePromptTooLong         BetaAdvisorToolResultErrorParamErrorCode = "prompt_too_long"
   531  	BetaAdvisorToolResultErrorParamErrorCodeTooManyRequests       BetaAdvisorToolResultErrorParamErrorCode = "too_many_requests"
   532  	BetaAdvisorToolResultErrorParamErrorCodeOverloaded            BetaAdvisorToolResultErrorParamErrorCode = "overloaded"
   533  	BetaAdvisorToolResultErrorParamErrorCodeUnavailable           BetaAdvisorToolResultErrorParamErrorCode = "unavailable"
   534  	BetaAdvisorToolResultErrorParamErrorCodeExecutionTimeExceeded BetaAdvisorToolResultErrorParamErrorCode = "execution_time_exceeded"
   535  	BetaAdvisorToolResultErrorParamErrorCodeModelNotFound         BetaAdvisorToolResultErrorParamErrorCode = "model_not_found"
   536  )
   537  
   538  func NewBetaAllThinkingTurnsParam() BetaAllThinkingTurnsParam {
   539  	return BetaAllThinkingTurnsParam{
   540  		Type: "all",
   541  	}
   542  }
   543  
   544  // This struct has a constant value, construct it with
   545  // [NewBetaAllThinkingTurnsParam].
   546  type BetaAllThinkingTurnsParam struct {
   547  	Type constant.All `json:"type" default:"all"`
   548  	paramObj
   549  }
   550  
   551  func (r BetaAllThinkingTurnsParam) MarshalJSON() (data []byte, err error) {
   552  	type shadow BetaAllThinkingTurnsParam
   553  	return param.MarshalObject(r, (*shadow)(&r))
   554  }
   555  func (r *BetaAllThinkingTurnsParam) UnmarshalJSON(data []byte) error {
   556  	return apijson.UnmarshalRoot(data, r)
   557  }
   558  
   559  // The properties Data, MediaType, Type are required.
   560  type BetaBase64ImageSourceParam struct {
   561  	Data string `json:"data" api:"required" format:"byte"`
   562  	// Any of "image/jpeg", "image/png", "image/gif", "image/webp".
   563  	MediaType BetaBase64ImageSourceMediaType `json:"media_type,omitzero" api:"required"`
   564  	// This field can be elided, and will marshal its zero value as "base64".
   565  	Type constant.Base64 `json:"type" default:"base64"`
   566  	paramObj
   567  }
   568  
   569  func (r BetaBase64ImageSourceParam) MarshalJSON() (data []byte, err error) {
   570  	type shadow BetaBase64ImageSourceParam
   571  	return param.MarshalObject(r, (*shadow)(&r))
   572  }
   573  func (r *BetaBase64ImageSourceParam) UnmarshalJSON(data []byte) error {
   574  	return apijson.UnmarshalRoot(data, r)
   575  }
   576  
   577  type BetaBase64ImageSourceMediaType string
   578  
   579  const (
   580  	BetaBase64ImageSourceMediaTypeImageJPEG BetaBase64ImageSourceMediaType = "image/jpeg"
   581  	BetaBase64ImageSourceMediaTypeImagePNG  BetaBase64ImageSourceMediaType = "image/png"
   582  	BetaBase64ImageSourceMediaTypeImageGIF  BetaBase64ImageSourceMediaType = "image/gif"
   583  	BetaBase64ImageSourceMediaTypeImageWebP BetaBase64ImageSourceMediaType = "image/webp"
   584  )
   585  
   586  type BetaBase64PDFSource struct {
   587  	Data      string                  `json:"data" api:"required" format:"byte"`
   588  	MediaType constant.ApplicationPDF `json:"media_type" default:"application/pdf"`
   589  	Type      constant.Base64         `json:"type" default:"base64"`
   590  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   591  	JSON struct {
   592  		Data        respjson.Field
   593  		MediaType   respjson.Field
   594  		Type        respjson.Field
   595  		ExtraFields map[string]respjson.Field
   596  		raw         string
   597  	} `json:"-"`
   598  }
   599  
   600  // Returns the unmodified JSON received from the API
   601  func (r BetaBase64PDFSource) RawJSON() string { return r.JSON.raw }
   602  func (r *BetaBase64PDFSource) UnmarshalJSON(data []byte) error {
   603  	return apijson.UnmarshalRoot(data, r)
   604  }
   605  
   606  // ToParam converts this BetaBase64PDFSource to a BetaBase64PDFSourceParam.
   607  //
   608  // Warning: the fields of the param type will not be present. ToParam should only
   609  // be used at the last possible moment before sending a request. Test for this with
   610  // BetaBase64PDFSourceParam.Overrides()
   611  func (r BetaBase64PDFSource) ToParam() BetaBase64PDFSourceParam {
   612  	return param.Override[BetaBase64PDFSourceParam](json.RawMessage(r.RawJSON()))
   613  }
   614  
   615  // The properties Data, MediaType, Type are required.
   616  type BetaBase64PDFSourceParam struct {
   617  	Data string `json:"data" api:"required" format:"byte"`
   618  	// This field can be elided, and will marshal its zero value as "application/pdf".
   619  	MediaType constant.ApplicationPDF `json:"media_type" default:"application/pdf"`
   620  	// This field can be elided, and will marshal its zero value as "base64".
   621  	Type constant.Base64 `json:"type" default:"base64"`
   622  	paramObj
   623  }
   624  
   625  func (r BetaBase64PDFSourceParam) MarshalJSON() (data []byte, err error) {
   626  	type shadow BetaBase64PDFSourceParam
   627  	return param.MarshalObject(r, (*shadow)(&r))
   628  }
   629  func (r *BetaBase64PDFSourceParam) UnmarshalJSON(data []byte) error {
   630  	return apijson.UnmarshalRoot(data, r)
   631  }
   632  
   633  type BetaBashCodeExecutionOutputBlock struct {
   634  	FileID string                           `json:"file_id" api:"required"`
   635  	Type   constant.BashCodeExecutionOutput `json:"type" default:"bash_code_execution_output"`
   636  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   637  	JSON struct {
   638  		FileID      respjson.Field
   639  		Type        respjson.Field
   640  		ExtraFields map[string]respjson.Field
   641  		raw         string
   642  	} `json:"-"`
   643  }
   644  
   645  // Returns the unmodified JSON received from the API
   646  func (r BetaBashCodeExecutionOutputBlock) RawJSON() string { return r.JSON.raw }
   647  func (r *BetaBashCodeExecutionOutputBlock) UnmarshalJSON(data []byte) error {
   648  	return apijson.UnmarshalRoot(data, r)
   649  }
   650  
   651  // The properties FileID, Type are required.
   652  type BetaBashCodeExecutionOutputBlockParam struct {
   653  	FileID string `json:"file_id" api:"required"`
   654  	// This field can be elided, and will marshal its zero value as
   655  	// "bash_code_execution_output".
   656  	Type constant.BashCodeExecutionOutput `json:"type" default:"bash_code_execution_output"`
   657  	paramObj
   658  }
   659  
   660  func (r BetaBashCodeExecutionOutputBlockParam) MarshalJSON() (data []byte, err error) {
   661  	type shadow BetaBashCodeExecutionOutputBlockParam
   662  	return param.MarshalObject(r, (*shadow)(&r))
   663  }
   664  func (r *BetaBashCodeExecutionOutputBlockParam) UnmarshalJSON(data []byte) error {
   665  	return apijson.UnmarshalRoot(data, r)
   666  }
   667  
   668  type BetaBashCodeExecutionResultBlock struct {
   669  	Content    []BetaBashCodeExecutionOutputBlock `json:"content" api:"required"`
   670  	ReturnCode int64                              `json:"return_code" api:"required"`
   671  	Stderr     string                             `json:"stderr" api:"required"`
   672  	Stdout     string                             `json:"stdout" api:"required"`
   673  	Type       constant.BashCodeExecutionResult   `json:"type" default:"bash_code_execution_result"`
   674  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   675  	JSON struct {
   676  		Content     respjson.Field
   677  		ReturnCode  respjson.Field
   678  		Stderr      respjson.Field
   679  		Stdout      respjson.Field
   680  		Type        respjson.Field
   681  		ExtraFields map[string]respjson.Field
   682  		raw         string
   683  	} `json:"-"`
   684  }
   685  
   686  // Returns the unmodified JSON received from the API
   687  func (r BetaBashCodeExecutionResultBlock) RawJSON() string { return r.JSON.raw }
   688  func (r *BetaBashCodeExecutionResultBlock) UnmarshalJSON(data []byte) error {
   689  	return apijson.UnmarshalRoot(data, r)
   690  }
   691  
   692  // The properties Content, ReturnCode, Stderr, Stdout, Type are required.
   693  type BetaBashCodeExecutionResultBlockParam struct {
   694  	Content    []BetaBashCodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
   695  	ReturnCode int64                                   `json:"return_code" api:"required"`
   696  	Stderr     string                                  `json:"stderr" api:"required"`
   697  	Stdout     string                                  `json:"stdout" api:"required"`
   698  	// This field can be elided, and will marshal its zero value as
   699  	// "bash_code_execution_result".
   700  	Type constant.BashCodeExecutionResult `json:"type" default:"bash_code_execution_result"`
   701  	paramObj
   702  }
   703  
   704  func (r BetaBashCodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error) {
   705  	type shadow BetaBashCodeExecutionResultBlockParam
   706  	return param.MarshalObject(r, (*shadow)(&r))
   707  }
   708  func (r *BetaBashCodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error {
   709  	return apijson.UnmarshalRoot(data, r)
   710  }
   711  
   712  type BetaBashCodeExecutionToolResultBlock struct {
   713  	Content   BetaBashCodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
   714  	ToolUseID string                                           `json:"tool_use_id" api:"required"`
   715  	Type      constant.BashCodeExecutionToolResult             `json:"type" default:"bash_code_execution_tool_result"`
   716  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   717  	JSON struct {
   718  		Content     respjson.Field
   719  		ToolUseID   respjson.Field
   720  		Type        respjson.Field
   721  		ExtraFields map[string]respjson.Field
   722  		raw         string
   723  	} `json:"-"`
   724  }
   725  
   726  // Returns the unmodified JSON received from the API
   727  func (r BetaBashCodeExecutionToolResultBlock) RawJSON() string { return r.JSON.raw }
   728  func (r *BetaBashCodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error {
   729  	return apijson.UnmarshalRoot(data, r)
   730  }
   731  
   732  // BetaBashCodeExecutionToolResultBlockContentUnion contains all possible
   733  // properties and values from [BetaBashCodeExecutionToolResultError],
   734  // [BetaBashCodeExecutionResultBlock].
   735  //
   736  // Use the methods beginning with 'As' to cast the union to one of its variants.
   737  type BetaBashCodeExecutionToolResultBlockContentUnion struct {
   738  	// This field is from variant [BetaBashCodeExecutionToolResultError].
   739  	ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode `json:"error_code"`
   740  	Type      string                                        `json:"type"`
   741  	// This field is from variant [BetaBashCodeExecutionResultBlock].
   742  	Content []BetaBashCodeExecutionOutputBlock `json:"content"`
   743  	// This field is from variant [BetaBashCodeExecutionResultBlock].
   744  	ReturnCode int64 `json:"return_code"`
   745  	// This field is from variant [BetaBashCodeExecutionResultBlock].
   746  	Stderr string `json:"stderr"`
   747  	// This field is from variant [BetaBashCodeExecutionResultBlock].
   748  	Stdout string `json:"stdout"`
   749  	JSON   struct {
   750  		ErrorCode  respjson.Field
   751  		Type       respjson.Field
   752  		Content    respjson.Field
   753  		ReturnCode respjson.Field
   754  		Stderr     respjson.Field
   755  		Stdout     respjson.Field
   756  		raw        string
   757  	} `json:"-"`
   758  }
   759  
   760  func (u BetaBashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionToolResultError() (v BetaBashCodeExecutionToolResultError) {
   761  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   762  	return
   763  }
   764  
   765  func (u BetaBashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionResultBlock() (v BetaBashCodeExecutionResultBlock) {
   766  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   767  	return
   768  }
   769  
   770  // Returns the unmodified JSON received from the API
   771  func (u BetaBashCodeExecutionToolResultBlockContentUnion) RawJSON() string { return u.JSON.raw }
   772  
   773  func (r *BetaBashCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error {
   774  	return apijson.UnmarshalRoot(data, r)
   775  }
   776  
   777  // The properties Content, ToolUseID, Type are required.
   778  type BetaBashCodeExecutionToolResultBlockParam struct {
   779  	Content   BetaBashCodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
   780  	ToolUseID string                                                `json:"tool_use_id" api:"required"`
   781  	// Create a cache control breakpoint at this content block.
   782  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
   783  	// This field can be elided, and will marshal its zero value as
   784  	// "bash_code_execution_tool_result".
   785  	Type constant.BashCodeExecutionToolResult `json:"type" default:"bash_code_execution_tool_result"`
   786  	paramObj
   787  }
   788  
   789  func (r BetaBashCodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error) {
   790  	type shadow BetaBashCodeExecutionToolResultBlockParam
   791  	return param.MarshalObject(r, (*shadow)(&r))
   792  }
   793  func (r *BetaBashCodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error {
   794  	return apijson.UnmarshalRoot(data, r)
   795  }
   796  
   797  // Only one field can be non-zero.
   798  //
   799  // Use [param.IsOmitted] to confirm if a field is set.
   800  type BetaBashCodeExecutionToolResultBlockParamContentUnion struct {
   801  	OfRequestBashCodeExecutionToolResultError *BetaBashCodeExecutionToolResultErrorParam `json:",omitzero,inline"`
   802  	OfRequestBashCodeExecutionResultBlock     *BetaBashCodeExecutionResultBlockParam     `json:",omitzero,inline"`
   803  	paramUnion
   804  }
   805  
   806  func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
   807  	return param.MarshalUnion(u, u.OfRequestBashCodeExecutionToolResultError, u.OfRequestBashCodeExecutionResultBlock)
   808  }
   809  func (u *BetaBashCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
   810  	return apijson.UnmarshalRoot(data, u)
   811  }
   812  
   813  func (u *BetaBashCodeExecutionToolResultBlockParamContentUnion) asAny() any {
   814  	if !param.IsOmitted(u.OfRequestBashCodeExecutionToolResultError) {
   815  		return u.OfRequestBashCodeExecutionToolResultError
   816  	} else if !param.IsOmitted(u.OfRequestBashCodeExecutionResultBlock) {
   817  		return u.OfRequestBashCodeExecutionResultBlock
   818  	}
   819  	return nil
   820  }
   821  
   822  // Returns a pointer to the underlying variant's property, if present.
   823  func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string {
   824  	if vt := u.OfRequestBashCodeExecutionToolResultError; vt != nil {
   825  		return (*string)(&vt.ErrorCode)
   826  	}
   827  	return nil
   828  }
   829  
   830  // Returns a pointer to the underlying variant's property, if present.
   831  func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetContent() []BetaBashCodeExecutionOutputBlockParam {
   832  	if vt := u.OfRequestBashCodeExecutionResultBlock; vt != nil {
   833  		return vt.Content
   834  	}
   835  	return nil
   836  }
   837  
   838  // Returns a pointer to the underlying variant's property, if present.
   839  func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64 {
   840  	if vt := u.OfRequestBashCodeExecutionResultBlock; vt != nil {
   841  		return &vt.ReturnCode
   842  	}
   843  	return nil
   844  }
   845  
   846  // Returns a pointer to the underlying variant's property, if present.
   847  func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetStderr() *string {
   848  	if vt := u.OfRequestBashCodeExecutionResultBlock; vt != nil {
   849  		return &vt.Stderr
   850  	}
   851  	return nil
   852  }
   853  
   854  // Returns a pointer to the underlying variant's property, if present.
   855  func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetStdout() *string {
   856  	if vt := u.OfRequestBashCodeExecutionResultBlock; vt != nil {
   857  		return &vt.Stdout
   858  	}
   859  	return nil
   860  }
   861  
   862  // Returns a pointer to the underlying variant's property, if present.
   863  func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetType() *string {
   864  	if vt := u.OfRequestBashCodeExecutionToolResultError; vt != nil {
   865  		return (*string)(&vt.Type)
   866  	} else if vt := u.OfRequestBashCodeExecutionResultBlock; vt != nil {
   867  		return (*string)(&vt.Type)
   868  	}
   869  	return nil
   870  }
   871  
   872  type BetaBashCodeExecutionToolResultError struct {
   873  	// Any of "invalid_tool_input", "unavailable", "too_many_requests",
   874  	// "execution_time_exceeded", "output_file_too_large".
   875  	ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode `json:"error_code" api:"required"`
   876  	Type      constant.BashCodeExecutionToolResultError     `json:"type" default:"bash_code_execution_tool_result_error"`
   877  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   878  	JSON struct {
   879  		ErrorCode   respjson.Field
   880  		Type        respjson.Field
   881  		ExtraFields map[string]respjson.Field
   882  		raw         string
   883  	} `json:"-"`
   884  }
   885  
   886  // Returns the unmodified JSON received from the API
   887  func (r BetaBashCodeExecutionToolResultError) RawJSON() string { return r.JSON.raw }
   888  func (r *BetaBashCodeExecutionToolResultError) UnmarshalJSON(data []byte) error {
   889  	return apijson.UnmarshalRoot(data, r)
   890  }
   891  
   892  type BetaBashCodeExecutionToolResultErrorErrorCode string
   893  
   894  const (
   895  	BetaBashCodeExecutionToolResultErrorErrorCodeInvalidToolInput      BetaBashCodeExecutionToolResultErrorErrorCode = "invalid_tool_input"
   896  	BetaBashCodeExecutionToolResultErrorErrorCodeUnavailable           BetaBashCodeExecutionToolResultErrorErrorCode = "unavailable"
   897  	BetaBashCodeExecutionToolResultErrorErrorCodeTooManyRequests       BetaBashCodeExecutionToolResultErrorErrorCode = "too_many_requests"
   898  	BetaBashCodeExecutionToolResultErrorErrorCodeExecutionTimeExceeded BetaBashCodeExecutionToolResultErrorErrorCode = "execution_time_exceeded"
   899  	BetaBashCodeExecutionToolResultErrorErrorCodeOutputFileTooLarge    BetaBashCodeExecutionToolResultErrorErrorCode = "output_file_too_large"
   900  )
   901  
   902  // The properties ErrorCode, Type are required.
   903  type BetaBashCodeExecutionToolResultErrorParam struct {
   904  	// Any of "invalid_tool_input", "unavailable", "too_many_requests",
   905  	// "execution_time_exceeded", "output_file_too_large".
   906  	ErrorCode BetaBashCodeExecutionToolResultErrorParamErrorCode `json:"error_code,omitzero" api:"required"`
   907  	// This field can be elided, and will marshal its zero value as
   908  	// "bash_code_execution_tool_result_error".
   909  	Type constant.BashCodeExecutionToolResultError `json:"type" default:"bash_code_execution_tool_result_error"`
   910  	paramObj
   911  }
   912  
   913  func (r BetaBashCodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error) {
   914  	type shadow BetaBashCodeExecutionToolResultErrorParam
   915  	return param.MarshalObject(r, (*shadow)(&r))
   916  }
   917  func (r *BetaBashCodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error {
   918  	return apijson.UnmarshalRoot(data, r)
   919  }
   920  
   921  type BetaBashCodeExecutionToolResultErrorParamErrorCode string
   922  
   923  const (
   924  	BetaBashCodeExecutionToolResultErrorParamErrorCodeInvalidToolInput      BetaBashCodeExecutionToolResultErrorParamErrorCode = "invalid_tool_input"
   925  	BetaBashCodeExecutionToolResultErrorParamErrorCodeUnavailable           BetaBashCodeExecutionToolResultErrorParamErrorCode = "unavailable"
   926  	BetaBashCodeExecutionToolResultErrorParamErrorCodeTooManyRequests       BetaBashCodeExecutionToolResultErrorParamErrorCode = "too_many_requests"
   927  	BetaBashCodeExecutionToolResultErrorParamErrorCodeExecutionTimeExceeded BetaBashCodeExecutionToolResultErrorParamErrorCode = "execution_time_exceeded"
   928  	BetaBashCodeExecutionToolResultErrorParamErrorCodeOutputFileTooLarge    BetaBashCodeExecutionToolResultErrorParamErrorCode = "output_file_too_large"
   929  )
   930  
   931  // `close_tab`'s config overrides.
   932  type BetaBrowserCloseTabConfigParam struct {
   933  	// Defer loading for this member. Must resolve to the same value on every enabled
   934  	// member of the toolset.
   935  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
   936  	// Whether this member is offered to the model. Default is per member, per the
   937  	// toolset's documentation. A member whose enabled resolves false is withheld from
   938  	// the served schema.
   939  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
   940  	paramObj
   941  }
   942  
   943  func (r BetaBrowserCloseTabConfigParam) MarshalJSON() (data []byte, err error) {
   944  	type shadow BetaBrowserCloseTabConfigParam
   945  	return param.MarshalObject(r, (*shadow)(&r))
   946  }
   947  func (r *BetaBrowserCloseTabConfigParam) UnmarshalJSON(data []byte) error {
   948  	return apijson.UnmarshalRoot(data, r)
   949  }
   950  
   951  // `double_click`'s config overrides.
   952  type BetaBrowserDoubleClickConfigParam struct {
   953  	// Defer loading for this member. Must resolve to the same value on every enabled
   954  	// member of the toolset.
   955  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
   956  	// Whether this member is offered to the model. Default is per member, per the
   957  	// toolset's documentation. A member whose enabled resolves false is withheld from
   958  	// the served schema.
   959  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
   960  	paramObj
   961  }
   962  
   963  func (r BetaBrowserDoubleClickConfigParam) MarshalJSON() (data []byte, err error) {
   964  	type shadow BetaBrowserDoubleClickConfigParam
   965  	return param.MarshalObject(r, (*shadow)(&r))
   966  }
   967  func (r *BetaBrowserDoubleClickConfigParam) UnmarshalJSON(data []byte) error {
   968  	return apijson.UnmarshalRoot(data, r)
   969  }
   970  
   971  // `file_upload`'s config overrides.
   972  type BetaBrowserFileUploadConfigParam struct {
   973  	// Defer loading for this member. Must resolve to the same value on every enabled
   974  	// member of the toolset.
   975  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
   976  	// Whether this member is offered to the model. Default is per member, per the
   977  	// toolset's documentation. A member whose enabled resolves false is withheld from
   978  	// the served schema.
   979  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
   980  	paramObj
   981  }
   982  
   983  func (r BetaBrowserFileUploadConfigParam) MarshalJSON() (data []byte, err error) {
   984  	type shadow BetaBrowserFileUploadConfigParam
   985  	return param.MarshalObject(r, (*shadow)(&r))
   986  }
   987  func (r *BetaBrowserFileUploadConfigParam) UnmarshalJSON(data []byte) error {
   988  	return apijson.UnmarshalRoot(data, r)
   989  }
   990  
   991  // `find`'s config overrides.
   992  type BetaBrowserFindConfigParam struct {
   993  	// Defer loading for this member. Must resolve to the same value on every enabled
   994  	// member of the toolset.
   995  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
   996  	// Whether this member is offered to the model. Default is per member, per the
   997  	// toolset's documentation. A member whose enabled resolves false is withheld from
   998  	// the served schema.
   999  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1000  	paramObj
  1001  }
  1002  
  1003  func (r BetaBrowserFindConfigParam) MarshalJSON() (data []byte, err error) {
  1004  	type shadow BetaBrowserFindConfigParam
  1005  	return param.MarshalObject(r, (*shadow)(&r))
  1006  }
  1007  func (r *BetaBrowserFindConfigParam) UnmarshalJSON(data []byte) error {
  1008  	return apijson.UnmarshalRoot(data, r)
  1009  }
  1010  
  1011  // `form_input`'s config overrides.
  1012  type BetaBrowserFormInputConfigParam struct {
  1013  	// Defer loading for this member. Must resolve to the same value on every enabled
  1014  	// member of the toolset.
  1015  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1016  	// Whether this member is offered to the model. Default is per member, per the
  1017  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1018  	// the served schema.
  1019  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1020  	paramObj
  1021  }
  1022  
  1023  func (r BetaBrowserFormInputConfigParam) MarshalJSON() (data []byte, err error) {
  1024  	type shadow BetaBrowserFormInputConfigParam
  1025  	return param.MarshalObject(r, (*shadow)(&r))
  1026  }
  1027  func (r *BetaBrowserFormInputConfigParam) UnmarshalJSON(data []byte) error {
  1028  	return apijson.UnmarshalRoot(data, r)
  1029  }
  1030  
  1031  // `get_page_text`'s config overrides.
  1032  type BetaBrowserGetPageTextConfigParam struct {
  1033  	// Defer loading for this member. Must resolve to the same value on every enabled
  1034  	// member of the toolset.
  1035  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1036  	// Whether this member is offered to the model. Default is per member, per the
  1037  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1038  	// the served schema.
  1039  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1040  	paramObj
  1041  }
  1042  
  1043  func (r BetaBrowserGetPageTextConfigParam) MarshalJSON() (data []byte, err error) {
  1044  	type shadow BetaBrowserGetPageTextConfigParam
  1045  	return param.MarshalObject(r, (*shadow)(&r))
  1046  }
  1047  func (r *BetaBrowserGetPageTextConfigParam) UnmarshalJSON(data []byte) error {
  1048  	return apijson.UnmarshalRoot(data, r)
  1049  }
  1050  
  1051  // `hold_key`'s config overrides.
  1052  type BetaBrowserHoldKeyConfigParam struct {
  1053  	// Defer loading for this member. Must resolve to the same value on every enabled
  1054  	// member of the toolset.
  1055  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1056  	// Whether this member is offered to the model. Default is per member, per the
  1057  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1058  	// the served schema.
  1059  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1060  	paramObj
  1061  }
  1062  
  1063  func (r BetaBrowserHoldKeyConfigParam) MarshalJSON() (data []byte, err error) {
  1064  	type shadow BetaBrowserHoldKeyConfigParam
  1065  	return param.MarshalObject(r, (*shadow)(&r))
  1066  }
  1067  func (r *BetaBrowserHoldKeyConfigParam) UnmarshalJSON(data []byte) error {
  1068  	return apijson.UnmarshalRoot(data, r)
  1069  }
  1070  
  1071  // `hover`'s config overrides.
  1072  type BetaBrowserHoverConfigParam struct {
  1073  	// Defer loading for this member. Must resolve to the same value on every enabled
  1074  	// member of the toolset.
  1075  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1076  	// Whether this member is offered to the model. Default is per member, per the
  1077  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1078  	// the served schema.
  1079  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1080  	paramObj
  1081  }
  1082  
  1083  func (r BetaBrowserHoverConfigParam) MarshalJSON() (data []byte, err error) {
  1084  	type shadow BetaBrowserHoverConfigParam
  1085  	return param.MarshalObject(r, (*shadow)(&r))
  1086  }
  1087  func (r *BetaBrowserHoverConfigParam) UnmarshalJSON(data []byte) error {
  1088  	return apijson.UnmarshalRoot(data, r)
  1089  }
  1090  
  1091  // `javascript_exec`'s config overrides.
  1092  type BetaBrowserJavascriptExecConfigParam struct {
  1093  	// Defer loading for this member. Must resolve to the same value on every enabled
  1094  	// member of the toolset.
  1095  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1096  	// Whether this member is offered to the model. Default is per member, per the
  1097  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1098  	// the served schema.
  1099  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1100  	paramObj
  1101  }
  1102  
  1103  func (r BetaBrowserJavascriptExecConfigParam) MarshalJSON() (data []byte, err error) {
  1104  	type shadow BetaBrowserJavascriptExecConfigParam
  1105  	return param.MarshalObject(r, (*shadow)(&r))
  1106  }
  1107  func (r *BetaBrowserJavascriptExecConfigParam) UnmarshalJSON(data []byte) error {
  1108  	return apijson.UnmarshalRoot(data, r)
  1109  }
  1110  
  1111  // `key`'s config overrides.
  1112  type BetaBrowserKeyConfigParam struct {
  1113  	// Defer loading for this member. Must resolve to the same value on every enabled
  1114  	// member of the toolset.
  1115  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1116  	// Whether this member is offered to the model. Default is per member, per the
  1117  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1118  	// the served schema.
  1119  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1120  	paramObj
  1121  }
  1122  
  1123  func (r BetaBrowserKeyConfigParam) MarshalJSON() (data []byte, err error) {
  1124  	type shadow BetaBrowserKeyConfigParam
  1125  	return param.MarshalObject(r, (*shadow)(&r))
  1126  }
  1127  func (r *BetaBrowserKeyConfigParam) UnmarshalJSON(data []byte) error {
  1128  	return apijson.UnmarshalRoot(data, r)
  1129  }
  1130  
  1131  // `left_click`'s config overrides.
  1132  type BetaBrowserLeftClickConfigParam struct {
  1133  	// Defer loading for this member. Must resolve to the same value on every enabled
  1134  	// member of the toolset.
  1135  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1136  	// Whether this member is offered to the model. Default is per member, per the
  1137  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1138  	// the served schema.
  1139  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1140  	paramObj
  1141  }
  1142  
  1143  func (r BetaBrowserLeftClickConfigParam) MarshalJSON() (data []byte, err error) {
  1144  	type shadow BetaBrowserLeftClickConfigParam
  1145  	return param.MarshalObject(r, (*shadow)(&r))
  1146  }
  1147  func (r *BetaBrowserLeftClickConfigParam) UnmarshalJSON(data []byte) error {
  1148  	return apijson.UnmarshalRoot(data, r)
  1149  }
  1150  
  1151  // `left_click_drag`'s config overrides.
  1152  type BetaBrowserLeftClickDragConfigParam struct {
  1153  	// Defer loading for this member. Must resolve to the same value on every enabled
  1154  	// member of the toolset.
  1155  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1156  	// Whether this member is offered to the model. Default is per member, per the
  1157  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1158  	// the served schema.
  1159  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1160  	paramObj
  1161  }
  1162  
  1163  func (r BetaBrowserLeftClickDragConfigParam) MarshalJSON() (data []byte, err error) {
  1164  	type shadow BetaBrowserLeftClickDragConfigParam
  1165  	return param.MarshalObject(r, (*shadow)(&r))
  1166  }
  1167  func (r *BetaBrowserLeftClickDragConfigParam) UnmarshalJSON(data []byte) error {
  1168  	return apijson.UnmarshalRoot(data, r)
  1169  }
  1170  
  1171  // `left_mouse_down`'s config overrides.
  1172  type BetaBrowserLeftMouseDownConfigParam struct {
  1173  	// Defer loading for this member. Must resolve to the same value on every enabled
  1174  	// member of the toolset.
  1175  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1176  	// Whether this member is offered to the model. Default is per member, per the
  1177  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1178  	// the served schema.
  1179  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1180  	paramObj
  1181  }
  1182  
  1183  func (r BetaBrowserLeftMouseDownConfigParam) MarshalJSON() (data []byte, err error) {
  1184  	type shadow BetaBrowserLeftMouseDownConfigParam
  1185  	return param.MarshalObject(r, (*shadow)(&r))
  1186  }
  1187  func (r *BetaBrowserLeftMouseDownConfigParam) UnmarshalJSON(data []byte) error {
  1188  	return apijson.UnmarshalRoot(data, r)
  1189  }
  1190  
  1191  // `left_mouse_up`'s config overrides.
  1192  type BetaBrowserLeftMouseUpConfigParam struct {
  1193  	// Defer loading for this member. Must resolve to the same value on every enabled
  1194  	// member of the toolset.
  1195  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1196  	// Whether this member is offered to the model. Default is per member, per the
  1197  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1198  	// the served schema.
  1199  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1200  	paramObj
  1201  }
  1202  
  1203  func (r BetaBrowserLeftMouseUpConfigParam) MarshalJSON() (data []byte, err error) {
  1204  	type shadow BetaBrowserLeftMouseUpConfigParam
  1205  	return param.MarshalObject(r, (*shadow)(&r))
  1206  }
  1207  func (r *BetaBrowserLeftMouseUpConfigParam) UnmarshalJSON(data []byte) error {
  1208  	return apijson.UnmarshalRoot(data, r)
  1209  }
  1210  
  1211  // `list_tabs`'s config overrides.
  1212  type BetaBrowserListTabsConfigParam struct {
  1213  	// Defer loading for this member. Must resolve to the same value on every enabled
  1214  	// member of the toolset.
  1215  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1216  	// Whether this member is offered to the model. Default is per member, per the
  1217  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1218  	// the served schema.
  1219  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1220  	paramObj
  1221  }
  1222  
  1223  func (r BetaBrowserListTabsConfigParam) MarshalJSON() (data []byte, err error) {
  1224  	type shadow BetaBrowserListTabsConfigParam
  1225  	return param.MarshalObject(r, (*shadow)(&r))
  1226  }
  1227  func (r *BetaBrowserListTabsConfigParam) UnmarshalJSON(data []byte) error {
  1228  	return apijson.UnmarshalRoot(data, r)
  1229  }
  1230  
  1231  // `middle_click`'s config overrides.
  1232  type BetaBrowserMiddleClickConfigParam struct {
  1233  	// Defer loading for this member. Must resolve to the same value on every enabled
  1234  	// member of the toolset.
  1235  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1236  	// Whether this member is offered to the model. Default is per member, per the
  1237  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1238  	// the served schema.
  1239  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1240  	paramObj
  1241  }
  1242  
  1243  func (r BetaBrowserMiddleClickConfigParam) MarshalJSON() (data []byte, err error) {
  1244  	type shadow BetaBrowserMiddleClickConfigParam
  1245  	return param.MarshalObject(r, (*shadow)(&r))
  1246  }
  1247  func (r *BetaBrowserMiddleClickConfigParam) UnmarshalJSON(data []byte) error {
  1248  	return apijson.UnmarshalRoot(data, r)
  1249  }
  1250  
  1251  // `mouse_move`'s config overrides.
  1252  type BetaBrowserMouseMoveConfigParam struct {
  1253  	// Defer loading for this member. Must resolve to the same value on every enabled
  1254  	// member of the toolset.
  1255  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1256  	// Whether this member is offered to the model. Default is per member, per the
  1257  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1258  	// the served schema.
  1259  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1260  	paramObj
  1261  }
  1262  
  1263  func (r BetaBrowserMouseMoveConfigParam) MarshalJSON() (data []byte, err error) {
  1264  	type shadow BetaBrowserMouseMoveConfigParam
  1265  	return param.MarshalObject(r, (*shadow)(&r))
  1266  }
  1267  func (r *BetaBrowserMouseMoveConfigParam) UnmarshalJSON(data []byte) error {
  1268  	return apijson.UnmarshalRoot(data, r)
  1269  }
  1270  
  1271  // `navigate`'s config overrides.
  1272  type BetaBrowserNavigateConfigParam struct {
  1273  	// Defer loading for this member. Must resolve to the same value on every enabled
  1274  	// member of the toolset.
  1275  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1276  	// Whether this member is offered to the model. Default is per member, per the
  1277  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1278  	// the served schema.
  1279  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1280  	paramObj
  1281  }
  1282  
  1283  func (r BetaBrowserNavigateConfigParam) MarshalJSON() (data []byte, err error) {
  1284  	type shadow BetaBrowserNavigateConfigParam
  1285  	return param.MarshalObject(r, (*shadow)(&r))
  1286  }
  1287  func (r *BetaBrowserNavigateConfigParam) UnmarshalJSON(data []byte) error {
  1288  	return apijson.UnmarshalRoot(data, r)
  1289  }
  1290  
  1291  // `new_tab`'s config overrides.
  1292  type BetaBrowserNewTabConfigParam struct {
  1293  	// Defer loading for this member. Must resolve to the same value on every enabled
  1294  	// member of the toolset.
  1295  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1296  	// Whether this member is offered to the model. Default is per member, per the
  1297  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1298  	// the served schema.
  1299  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1300  	paramObj
  1301  }
  1302  
  1303  func (r BetaBrowserNewTabConfigParam) MarshalJSON() (data []byte, err error) {
  1304  	type shadow BetaBrowserNewTabConfigParam
  1305  	return param.MarshalObject(r, (*shadow)(&r))
  1306  }
  1307  func (r *BetaBrowserNewTabConfigParam) UnmarshalJSON(data []byte) error {
  1308  	return apijson.UnmarshalRoot(data, r)
  1309  }
  1310  
  1311  // `read_console`'s config overrides.
  1312  type BetaBrowserReadConsoleConfigParam struct {
  1313  	// Defer loading for this member. Must resolve to the same value on every enabled
  1314  	// member of the toolset.
  1315  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1316  	// Whether this member is offered to the model. Default is per member, per the
  1317  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1318  	// the served schema.
  1319  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1320  	paramObj
  1321  }
  1322  
  1323  func (r BetaBrowserReadConsoleConfigParam) MarshalJSON() (data []byte, err error) {
  1324  	type shadow BetaBrowserReadConsoleConfigParam
  1325  	return param.MarshalObject(r, (*shadow)(&r))
  1326  }
  1327  func (r *BetaBrowserReadConsoleConfigParam) UnmarshalJSON(data []byte) error {
  1328  	return apijson.UnmarshalRoot(data, r)
  1329  }
  1330  
  1331  // `read_network`'s config overrides.
  1332  type BetaBrowserReadNetworkConfigParam struct {
  1333  	// Defer loading for this member. Must resolve to the same value on every enabled
  1334  	// member of the toolset.
  1335  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1336  	// Whether this member is offered to the model. Default is per member, per the
  1337  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1338  	// the served schema.
  1339  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1340  	paramObj
  1341  }
  1342  
  1343  func (r BetaBrowserReadNetworkConfigParam) MarshalJSON() (data []byte, err error) {
  1344  	type shadow BetaBrowserReadNetworkConfigParam
  1345  	return param.MarshalObject(r, (*shadow)(&r))
  1346  }
  1347  func (r *BetaBrowserReadNetworkConfigParam) UnmarshalJSON(data []byte) error {
  1348  	return apijson.UnmarshalRoot(data, r)
  1349  }
  1350  
  1351  // `read_page`'s config overrides.
  1352  type BetaBrowserReadPageConfigParam struct {
  1353  	// Defer loading for this member. Must resolve to the same value on every enabled
  1354  	// member of the toolset.
  1355  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1356  	// Whether this member is offered to the model. Default is per member, per the
  1357  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1358  	// the served schema.
  1359  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1360  	paramObj
  1361  }
  1362  
  1363  func (r BetaBrowserReadPageConfigParam) MarshalJSON() (data []byte, err error) {
  1364  	type shadow BetaBrowserReadPageConfigParam
  1365  	return param.MarshalObject(r, (*shadow)(&r))
  1366  }
  1367  func (r *BetaBrowserReadPageConfigParam) UnmarshalJSON(data []byte) error {
  1368  	return apijson.UnmarshalRoot(data, r)
  1369  }
  1370  
  1371  // `right_click`'s config overrides.
  1372  type BetaBrowserRightClickConfigParam struct {
  1373  	// Defer loading for this member. Must resolve to the same value on every enabled
  1374  	// member of the toolset.
  1375  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1376  	// Whether this member is offered to the model. Default is per member, per the
  1377  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1378  	// the served schema.
  1379  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1380  	paramObj
  1381  }
  1382  
  1383  func (r BetaBrowserRightClickConfigParam) MarshalJSON() (data []byte, err error) {
  1384  	type shadow BetaBrowserRightClickConfigParam
  1385  	return param.MarshalObject(r, (*shadow)(&r))
  1386  }
  1387  func (r *BetaBrowserRightClickConfigParam) UnmarshalJSON(data []byte) error {
  1388  	return apijson.UnmarshalRoot(data, r)
  1389  }
  1390  
  1391  // `screenshot`'s config overrides.
  1392  type BetaBrowserScreenshotConfigParam struct {
  1393  	// Defer loading for this member. Must resolve to the same value on every enabled
  1394  	// member of the toolset.
  1395  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1396  	// Whether this member is offered to the model. Default is per member, per the
  1397  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1398  	// the served schema.
  1399  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1400  	paramObj
  1401  }
  1402  
  1403  func (r BetaBrowserScreenshotConfigParam) MarshalJSON() (data []byte, err error) {
  1404  	type shadow BetaBrowserScreenshotConfigParam
  1405  	return param.MarshalObject(r, (*shadow)(&r))
  1406  }
  1407  func (r *BetaBrowserScreenshotConfigParam) UnmarshalJSON(data []byte) error {
  1408  	return apijson.UnmarshalRoot(data, r)
  1409  }
  1410  
  1411  // `scroll`'s config overrides.
  1412  type BetaBrowserScrollConfigParam struct {
  1413  	// Defer loading for this member. Must resolve to the same value on every enabled
  1414  	// member of the toolset.
  1415  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1416  	// Whether this member is offered to the model. Default is per member, per the
  1417  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1418  	// the served schema.
  1419  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1420  	paramObj
  1421  }
  1422  
  1423  func (r BetaBrowserScrollConfigParam) MarshalJSON() (data []byte, err error) {
  1424  	type shadow BetaBrowserScrollConfigParam
  1425  	return param.MarshalObject(r, (*shadow)(&r))
  1426  }
  1427  func (r *BetaBrowserScrollConfigParam) UnmarshalJSON(data []byte) error {
  1428  	return apijson.UnmarshalRoot(data, r)
  1429  }
  1430  
  1431  // `scroll_to`'s config overrides.
  1432  type BetaBrowserScrollToConfigParam struct {
  1433  	// Defer loading for this member. Must resolve to the same value on every enabled
  1434  	// member of the toolset.
  1435  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1436  	// Whether this member is offered to the model. Default is per member, per the
  1437  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1438  	// the served schema.
  1439  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1440  	paramObj
  1441  }
  1442  
  1443  func (r BetaBrowserScrollToConfigParam) MarshalJSON() (data []byte, err error) {
  1444  	type shadow BetaBrowserScrollToConfigParam
  1445  	return param.MarshalObject(r, (*shadow)(&r))
  1446  }
  1447  func (r *BetaBrowserScrollToConfigParam) UnmarshalJSON(data []byte) error {
  1448  	return apijson.UnmarshalRoot(data, r)
  1449  }
  1450  
  1451  // The caller's browser state after a browser toolset member call — the full
  1452  // inventory of open tabs, which tab is active, and any side effects (tabs opened,
  1453  // download state changes) the call produced.
  1454  //
  1455  // At most one per `tool_result`, only on a non-error result answering a browser
  1456  // toolset member `tool_use`. The server renders the model-visible text from it;
  1457  // the model never sees the raw fields.
  1458  //
  1459  // The properties Tabs, Type are required.
  1460  type BetaBrowserStateBlockParam struct {
  1461  	// All tabs open in the browser after this call — the full inventory, not a delta.
  1462  	// May be empty. Whenever non-empty, exactly one entry carries `active: true`.
  1463  	Tabs []BetaBrowserStateTabEntryParam `json:"tabs,omitzero" api:"required"`
  1464  	// Tabs opened and download state changes during this call. "Nothing to report" is
  1465  	// expressed by omitting the field, never by an empty list.
  1466  	StateChanges []BetaBrowserStateChangeUnionParam `json:"state_changes,omitzero"`
  1467  	// Create a cache control breakpoint at this content block.
  1468  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  1469  	// This field can be elided, and will marshal its zero value as "browser_state".
  1470  	Type constant.BrowserState `json:"type" default:"browser_state"`
  1471  	paramObj
  1472  }
  1473  
  1474  func (r BetaBrowserStateBlockParam) MarshalJSON() (data []byte, err error) {
  1475  	type shadow BetaBrowserStateBlockParam
  1476  	return param.MarshalObject(r, (*shadow)(&r))
  1477  }
  1478  func (r *BetaBrowserStateBlockParam) UnmarshalJSON(data []byte) error {
  1479  	return apijson.UnmarshalRoot(data, r)
  1480  }
  1481  
  1482  func BetaBrowserStateChangeParamOfTabOpened(tabID string) BetaBrowserStateChangeUnionParam {
  1483  	var tabOpened BetaBrowserStateChangeTabOpenedParam
  1484  	tabOpened.TabID = tabID
  1485  	return BetaBrowserStateChangeUnionParam{OfTabOpened: &tabOpened}
  1486  }
  1487  
  1488  func BetaBrowserStateChangeParamOfDownloadStarted(downloadID string, url string) BetaBrowserStateChangeUnionParam {
  1489  	var downloadStarted BetaBrowserStateChangeDownloadStartedParam
  1490  	downloadStarted.DownloadID = downloadID
  1491  	downloadStarted.URL = url
  1492  	return BetaBrowserStateChangeUnionParam{OfDownloadStarted: &downloadStarted}
  1493  }
  1494  
  1495  func BetaBrowserStateChangeParamOfDownloadCompleted(downloadID string, url string) BetaBrowserStateChangeUnionParam {
  1496  	var downloadCompleted BetaBrowserStateChangeDownloadCompletedParam
  1497  	downloadCompleted.DownloadID = downloadID
  1498  	downloadCompleted.URL = url
  1499  	return BetaBrowserStateChangeUnionParam{OfDownloadCompleted: &downloadCompleted}
  1500  }
  1501  
  1502  func BetaBrowserStateChangeParamOfDownloadFailed(downloadID string, url string) BetaBrowserStateChangeUnionParam {
  1503  	var downloadFailed BetaBrowserStateChangeDownloadFailedParam
  1504  	downloadFailed.DownloadID = downloadID
  1505  	downloadFailed.URL = url
  1506  	return BetaBrowserStateChangeUnionParam{OfDownloadFailed: &downloadFailed}
  1507  }
  1508  
  1509  // Only one field can be non-zero.
  1510  //
  1511  // Use [param.IsOmitted] to confirm if a field is set.
  1512  type BetaBrowserStateChangeUnionParam struct {
  1513  	OfTabOpened         *BetaBrowserStateChangeTabOpenedParam         `json:",omitzero,inline"`
  1514  	OfDownloadStarted   *BetaBrowserStateChangeDownloadStartedParam   `json:",omitzero,inline"`
  1515  	OfDownloadCompleted *BetaBrowserStateChangeDownloadCompletedParam `json:",omitzero,inline"`
  1516  	OfDownloadFailed    *BetaBrowserStateChangeDownloadFailedParam    `json:",omitzero,inline"`
  1517  	paramUnion
  1518  }
  1519  
  1520  func (u BetaBrowserStateChangeUnionParam) MarshalJSON() ([]byte, error) {
  1521  	return param.MarshalUnion(u, u.OfTabOpened, u.OfDownloadStarted, u.OfDownloadCompleted, u.OfDownloadFailed)
  1522  }
  1523  func (u *BetaBrowserStateChangeUnionParam) UnmarshalJSON(data []byte) error {
  1524  	return apijson.UnmarshalRoot(data, u)
  1525  }
  1526  
  1527  func (u *BetaBrowserStateChangeUnionParam) asAny() any {
  1528  	if !param.IsOmitted(u.OfTabOpened) {
  1529  		return u.OfTabOpened
  1530  	} else if !param.IsOmitted(u.OfDownloadStarted) {
  1531  		return u.OfDownloadStarted
  1532  	} else if !param.IsOmitted(u.OfDownloadCompleted) {
  1533  		return u.OfDownloadCompleted
  1534  	} else if !param.IsOmitted(u.OfDownloadFailed) {
  1535  		return u.OfDownloadFailed
  1536  	}
  1537  	return nil
  1538  }
  1539  
  1540  // Returns a pointer to the underlying variant's property, if present.
  1541  func (u BetaBrowserStateChangeUnionParam) GetTabID() *string {
  1542  	if vt := u.OfTabOpened; vt != nil {
  1543  		return &vt.TabID
  1544  	}
  1545  	return nil
  1546  }
  1547  
  1548  // Returns a pointer to the underlying variant's property, if present.
  1549  func (u BetaBrowserStateChangeUnionParam) GetPath() *string {
  1550  	if vt := u.OfDownloadCompleted; vt != nil && vt.Path.Valid() {
  1551  		return &vt.Path.Value
  1552  	}
  1553  	return nil
  1554  }
  1555  
  1556  // Returns a pointer to the underlying variant's property, if present.
  1557  func (u BetaBrowserStateChangeUnionParam) GetSizeBytes() *int64 {
  1558  	if vt := u.OfDownloadCompleted; vt != nil && vt.SizeBytes.Valid() {
  1559  		return &vt.SizeBytes.Value
  1560  	}
  1561  	return nil
  1562  }
  1563  
  1564  // Returns a pointer to the underlying variant's property, if present.
  1565  func (u BetaBrowserStateChangeUnionParam) GetError() *string {
  1566  	if vt := u.OfDownloadFailed; vt != nil && vt.Error.Valid() {
  1567  		return &vt.Error.Value
  1568  	}
  1569  	return nil
  1570  }
  1571  
  1572  // Returns a pointer to the underlying variant's property, if present.
  1573  func (u BetaBrowserStateChangeUnionParam) GetType() *string {
  1574  	if vt := u.OfTabOpened; vt != nil {
  1575  		return (*string)(&vt.Type)
  1576  	} else if vt := u.OfDownloadStarted; vt != nil {
  1577  		return (*string)(&vt.Type)
  1578  	} else if vt := u.OfDownloadCompleted; vt != nil {
  1579  		return (*string)(&vt.Type)
  1580  	} else if vt := u.OfDownloadFailed; vt != nil {
  1581  		return (*string)(&vt.Type)
  1582  	}
  1583  	return nil
  1584  }
  1585  
  1586  // Returns a pointer to the underlying variant's property, if present.
  1587  func (u BetaBrowserStateChangeUnionParam) GetDownloadID() *string {
  1588  	if vt := u.OfDownloadStarted; vt != nil {
  1589  		return (*string)(&vt.DownloadID)
  1590  	} else if vt := u.OfDownloadCompleted; vt != nil {
  1591  		return (*string)(&vt.DownloadID)
  1592  	} else if vt := u.OfDownloadFailed; vt != nil {
  1593  		return (*string)(&vt.DownloadID)
  1594  	}
  1595  	return nil
  1596  }
  1597  
  1598  // Returns a pointer to the underlying variant's property, if present.
  1599  func (u BetaBrowserStateChangeUnionParam) GetURL() *string {
  1600  	if vt := u.OfDownloadStarted; vt != nil {
  1601  		return (*string)(&vt.URL)
  1602  	} else if vt := u.OfDownloadCompleted; vt != nil {
  1603  		return (*string)(&vt.URL)
  1604  	} else if vt := u.OfDownloadFailed; vt != nil {
  1605  		return (*string)(&vt.URL)
  1606  	}
  1607  	return nil
  1608  }
  1609  
  1610  func init() {
  1611  	apijson.RegisterUnion[BetaBrowserStateChangeUnionParam](
  1612  		"type",
  1613  		apijson.Discriminator[BetaBrowserStateChangeTabOpenedParam]("tab_opened"),
  1614  		apijson.Discriminator[BetaBrowserStateChangeDownloadStartedParam]("download_started"),
  1615  		apijson.Discriminator[BetaBrowserStateChangeDownloadCompletedParam]("download_completed"),
  1616  		apijson.Discriminator[BetaBrowserStateChangeDownloadFailedParam]("download_failed"),
  1617  	)
  1618  }
  1619  
  1620  // A file download that finished during this call, reported with the same
  1621  // `download_id` as its `download_started` — or without a prior `download_started`,
  1622  // when the download finished during the call that started it (at most one state
  1623  // change per `download_id` per result).
  1624  //
  1625  // The properties DownloadID, Type, URL are required.
  1626  type BetaBrowserStateChangeDownloadCompletedParam struct {
  1627  	// The caller-assigned identifier for this download, stable across the state
  1628  	// changes reporting it.
  1629  	DownloadID string `json:"download_id" api:"required"`
  1630  	// The final post-redirect URL the download was served from.
  1631  	URL string `json:"url" api:"required"`
  1632  	// Where the executor saved the file, on the executor's filesystem. Only included
  1633  	// when another tool in the same environment can read the file at that path.
  1634  	Path param.Opt[string] `json:"path,omitzero"`
  1635  	// The completed download's size.
  1636  	SizeBytes param.Opt[int64] `json:"size_bytes,omitzero"`
  1637  	// This field can be elided, and will marshal its zero value as
  1638  	// "download_completed".
  1639  	Type constant.DownloadCompleted `json:"type" default:"download_completed"`
  1640  	paramObj
  1641  }
  1642  
  1643  func (r BetaBrowserStateChangeDownloadCompletedParam) MarshalJSON() (data []byte, err error) {
  1644  	type shadow BetaBrowserStateChangeDownloadCompletedParam
  1645  	return param.MarshalObject(r, (*shadow)(&r))
  1646  }
  1647  func (r *BetaBrowserStateChangeDownloadCompletedParam) UnmarshalJSON(data []byte) error {
  1648  	return apijson.UnmarshalRoot(data, r)
  1649  }
  1650  
  1651  // A file download that failed — or was cancelled — during this call.
  1652  //
  1653  // The properties DownloadID, Type, URL are required.
  1654  type BetaBrowserStateChangeDownloadFailedParam struct {
  1655  	// The caller-assigned identifier for this download, stable across the state
  1656  	// changes reporting it.
  1657  	DownloadID string `json:"download_id" api:"required"`
  1658  	// The final post-redirect URL the download was served from.
  1659  	URL string `json:"url" api:"required"`
  1660  	// The failure or cancellation detail, when known.
  1661  	Error param.Opt[string] `json:"error,omitzero"`
  1662  	// This field can be elided, and will marshal its zero value as "download_failed".
  1663  	Type constant.DownloadFailed `json:"type" default:"download_failed"`
  1664  	paramObj
  1665  }
  1666  
  1667  func (r BetaBrowserStateChangeDownloadFailedParam) MarshalJSON() (data []byte, err error) {
  1668  	type shadow BetaBrowserStateChangeDownloadFailedParam
  1669  	return param.MarshalObject(r, (*shadow)(&r))
  1670  }
  1671  func (r *BetaBrowserStateChangeDownloadFailedParam) UnmarshalJSON(data []byte) error {
  1672  	return apijson.UnmarshalRoot(data, r)
  1673  }
  1674  
  1675  // A file download that started during this call.
  1676  //
  1677  // The properties DownloadID, Type, URL are required.
  1678  type BetaBrowserStateChangeDownloadStartedParam struct {
  1679  	// The caller-assigned identifier for this download, stable across the state
  1680  	// changes reporting it.
  1681  	DownloadID string `json:"download_id" api:"required"`
  1682  	// The final post-redirect URL the download was served from.
  1683  	URL string `json:"url" api:"required"`
  1684  	// This field can be elided, and will marshal its zero value as "download_started".
  1685  	Type constant.DownloadStarted `json:"type" default:"download_started"`
  1686  	paramObj
  1687  }
  1688  
  1689  func (r BetaBrowserStateChangeDownloadStartedParam) MarshalJSON() (data []byte, err error) {
  1690  	type shadow BetaBrowserStateChangeDownloadStartedParam
  1691  	return param.MarshalObject(r, (*shadow)(&r))
  1692  }
  1693  func (r *BetaBrowserStateChangeDownloadStartedParam) UnmarshalJSON(data []byte) error {
  1694  	return apijson.UnmarshalRoot(data, r)
  1695  }
  1696  
  1697  // A tab this call's execution opened that remains open at its end — the creation
  1698  // delta of the `tabs` inventory, not an event log.
  1699  //
  1700  // Carries only the `tab_id`; the tab's `title` and `url` live on its `tabs` entry,
  1701  // which must include the same `tab_id`. A tab opened during a failed call gets no
  1702  // deferred `tab_opened`; it simply appears in the next result's `tabs` inventory.
  1703  //
  1704  // The properties TabID, Type are required.
  1705  type BetaBrowserStateChangeTabOpenedParam struct {
  1706  	// The `tab_id` of the opened tab, present in `tabs`.
  1707  	TabID string `json:"tab_id" api:"required"`
  1708  	// This field can be elided, and will marshal its zero value as "tab_opened".
  1709  	Type constant.TabOpened `json:"type" default:"tab_opened"`
  1710  	paramObj
  1711  }
  1712  
  1713  func (r BetaBrowserStateChangeTabOpenedParam) MarshalJSON() (data []byte, err error) {
  1714  	type shadow BetaBrowserStateChangeTabOpenedParam
  1715  	return param.MarshalObject(r, (*shadow)(&r))
  1716  }
  1717  func (r *BetaBrowserStateChangeTabOpenedParam) UnmarshalJSON(data []byte) error {
  1718  	return apijson.UnmarshalRoot(data, r)
  1719  }
  1720  
  1721  // One open browser tab reported in a `browser_state` block's `tabs` inventory.
  1722  //
  1723  // `tab_id` is the caller-assigned identifier for the tab; `title` and `url`
  1724  // describe the page the tab is currently showing and may be empty strings (a blank
  1725  // tab legitimately has both empty). `active` marks the tab that is active after
  1726  // this call; whenever `tabs` is non-empty, exactly one entry is marked.
  1727  //
  1728  // The properties TabID, Title, URL are required.
  1729  type BetaBrowserStateTabEntryParam struct {
  1730  	// The caller-assigned identifier for this tab, unique within the inventory.
  1731  	TabID string `json:"tab_id" api:"required"`
  1732  	// The title of the page the tab is showing. May be empty.
  1733  	Title string `json:"title" api:"required"`
  1734  	// The URL of the page the tab is showing. May be empty.
  1735  	URL string `json:"url" api:"required"`
  1736  	// Whether this tab is the active tab after this call. Whenever `tabs` is
  1737  	// non-empty, exactly one entry is marked `active: true`.
  1738  	Active param.Opt[bool] `json:"active,omitzero"`
  1739  	paramObj
  1740  }
  1741  
  1742  func (r BetaBrowserStateTabEntryParam) MarshalJSON() (data []byte, err error) {
  1743  	type shadow BetaBrowserStateTabEntryParam
  1744  	return param.MarshalObject(r, (*shadow)(&r))
  1745  }
  1746  func (r *BetaBrowserStateTabEntryParam) UnmarshalJSON(data []byte) error {
  1747  	return apijson.UnmarshalRoot(data, r)
  1748  }
  1749  
  1750  // `switch_tab`'s config overrides.
  1751  type BetaBrowserSwitchTabConfigParam struct {
  1752  	// Defer loading for this member. Must resolve to the same value on every enabled
  1753  	// member of the toolset.
  1754  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1755  	// Whether this member is offered to the model. Default is per member, per the
  1756  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1757  	// the served schema.
  1758  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1759  	paramObj
  1760  }
  1761  
  1762  func (r BetaBrowserSwitchTabConfigParam) MarshalJSON() (data []byte, err error) {
  1763  	type shadow BetaBrowserSwitchTabConfigParam
  1764  	return param.MarshalObject(r, (*shadow)(&r))
  1765  }
  1766  func (r *BetaBrowserSwitchTabConfigParam) UnmarshalJSON(data []byte) error {
  1767  	return apijson.UnmarshalRoot(data, r)
  1768  }
  1769  
  1770  // The browser toolset: a single `tools[]` entry (carrying no `name`) that declares
  1771  // the browser tool family. The model is served the family's tool with any members
  1772  // disabled via `configs` removed from its schema.
  1773  //
  1774  // The property Type is required.
  1775  type BetaBrowserToolset20260801Param struct {
  1776  	// Create a cache control breakpoint at this content block.
  1777  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  1778  	// Per-member configuration for `browser_toolset_20260801`: one optional field per
  1779  	// member tool, keyed by the member name — the same name the member's `tool_use`
  1780  	// blocks carry. Every member is an accepted key, and a member's defaults apply
  1781  	// wherever its key is absent. Unknown keys are rejected: the field set is this
  1782  	// toolset version's complete member set.
  1783  	Configs BetaBrowserToolsetConfigsParam `json:"configs,omitzero"`
  1784  	// This field can be elided, and will marshal its zero value as
  1785  	// "browser_toolset_20260801".
  1786  	Type constant.BrowserToolset20260801 `json:"type" default:"browser_toolset_20260801"`
  1787  	paramObj
  1788  }
  1789  
  1790  func (r BetaBrowserToolset20260801Param) MarshalJSON() (data []byte, err error) {
  1791  	type shadow BetaBrowserToolset20260801Param
  1792  	return param.MarshalObject(r, (*shadow)(&r))
  1793  }
  1794  func (r *BetaBrowserToolset20260801Param) UnmarshalJSON(data []byte) error {
  1795  	return apijson.UnmarshalRoot(data, r)
  1796  }
  1797  
  1798  // Per-member configuration for `browser_toolset_20260801`: one optional field per
  1799  // member tool, keyed by the member name — the same name the member's `tool_use`
  1800  // blocks carry. Every member is an accepted key, and a member's defaults apply
  1801  // wherever its key is absent. Unknown keys are rejected: the field set is this
  1802  // toolset version's complete member set.
  1803  type BetaBrowserToolsetConfigsParam struct {
  1804  	// `close_tab`'s config overrides.
  1805  	CloseTab BetaBrowserCloseTabConfigParam `json:"close_tab,omitzero"`
  1806  	// `double_click`'s config overrides.
  1807  	DoubleClick BetaBrowserDoubleClickConfigParam `json:"double_click,omitzero"`
  1808  	// `file_upload`'s config overrides.
  1809  	FileUpload BetaBrowserFileUploadConfigParam `json:"file_upload,omitzero"`
  1810  	// `find`'s config overrides.
  1811  	Find BetaBrowserFindConfigParam `json:"find,omitzero"`
  1812  	// `form_input`'s config overrides.
  1813  	FormInput BetaBrowserFormInputConfigParam `json:"form_input,omitzero"`
  1814  	// `get_page_text`'s config overrides.
  1815  	GetPageText BetaBrowserGetPageTextConfigParam `json:"get_page_text,omitzero"`
  1816  	// `hold_key`'s config overrides.
  1817  	HoldKey BetaBrowserHoldKeyConfigParam `json:"hold_key,omitzero"`
  1818  	// `hover`'s config overrides.
  1819  	Hover BetaBrowserHoverConfigParam `json:"hover,omitzero"`
  1820  	// `javascript_exec`'s config overrides.
  1821  	JavascriptExec BetaBrowserJavascriptExecConfigParam `json:"javascript_exec,omitzero"`
  1822  	// `key`'s config overrides.
  1823  	Key BetaBrowserKeyConfigParam `json:"key,omitzero"`
  1824  	// `left_click`'s config overrides.
  1825  	LeftClick BetaBrowserLeftClickConfigParam `json:"left_click,omitzero"`
  1826  	// `left_click_drag`'s config overrides.
  1827  	LeftClickDrag BetaBrowserLeftClickDragConfigParam `json:"left_click_drag,omitzero"`
  1828  	// `left_mouse_down`'s config overrides.
  1829  	LeftMouseDown BetaBrowserLeftMouseDownConfigParam `json:"left_mouse_down,omitzero"`
  1830  	// `left_mouse_up`'s config overrides.
  1831  	LeftMouseUp BetaBrowserLeftMouseUpConfigParam `json:"left_mouse_up,omitzero"`
  1832  	// `list_tabs`'s config overrides.
  1833  	ListTabs BetaBrowserListTabsConfigParam `json:"list_tabs,omitzero"`
  1834  	// `middle_click`'s config overrides.
  1835  	MiddleClick BetaBrowserMiddleClickConfigParam `json:"middle_click,omitzero"`
  1836  	// `mouse_move`'s config overrides.
  1837  	MouseMove BetaBrowserMouseMoveConfigParam `json:"mouse_move,omitzero"`
  1838  	// `navigate`'s config overrides.
  1839  	Navigate BetaBrowserNavigateConfigParam `json:"navigate,omitzero"`
  1840  	// `new_tab`'s config overrides.
  1841  	NewTab BetaBrowserNewTabConfigParam `json:"new_tab,omitzero"`
  1842  	// `read_console`'s config overrides.
  1843  	ReadConsole BetaBrowserReadConsoleConfigParam `json:"read_console,omitzero"`
  1844  	// `read_network`'s config overrides.
  1845  	ReadNetwork BetaBrowserReadNetworkConfigParam `json:"read_network,omitzero"`
  1846  	// `read_page`'s config overrides.
  1847  	ReadPage BetaBrowserReadPageConfigParam `json:"read_page,omitzero"`
  1848  	// `right_click`'s config overrides.
  1849  	RightClick BetaBrowserRightClickConfigParam `json:"right_click,omitzero"`
  1850  	// `screenshot`'s config overrides.
  1851  	Screenshot BetaBrowserScreenshotConfigParam `json:"screenshot,omitzero"`
  1852  	// `scroll`'s config overrides.
  1853  	Scroll BetaBrowserScrollConfigParam `json:"scroll,omitzero"`
  1854  	// `scroll_to`'s config overrides.
  1855  	ScrollTo BetaBrowserScrollToConfigParam `json:"scroll_to,omitzero"`
  1856  	// `switch_tab`'s config overrides.
  1857  	SwitchTab BetaBrowserSwitchTabConfigParam `json:"switch_tab,omitzero"`
  1858  	// `triple_click`'s config overrides.
  1859  	TripleClick BetaBrowserTripleClickConfigParam `json:"triple_click,omitzero"`
  1860  	// `type`'s config overrides.
  1861  	Type BetaBrowserTypeConfigParam `json:"type,omitzero"`
  1862  	// `wait`'s config overrides.
  1863  	Wait BetaBrowserWaitConfigParam `json:"wait,omitzero"`
  1864  	// `zoom`'s config overrides.
  1865  	Zoom BetaBrowserZoomConfigParam `json:"zoom,omitzero"`
  1866  	paramObj
  1867  }
  1868  
  1869  func (r BetaBrowserToolsetConfigsParam) MarshalJSON() (data []byte, err error) {
  1870  	type shadow BetaBrowserToolsetConfigsParam
  1871  	return param.MarshalObject(r, (*shadow)(&r))
  1872  }
  1873  func (r *BetaBrowserToolsetConfigsParam) UnmarshalJSON(data []byte) error {
  1874  	return apijson.UnmarshalRoot(data, r)
  1875  }
  1876  
  1877  // `triple_click`'s config overrides.
  1878  type BetaBrowserTripleClickConfigParam struct {
  1879  	// Defer loading for this member. Must resolve to the same value on every enabled
  1880  	// member of the toolset.
  1881  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1882  	// Whether this member is offered to the model. Default is per member, per the
  1883  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1884  	// the served schema.
  1885  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1886  	paramObj
  1887  }
  1888  
  1889  func (r BetaBrowserTripleClickConfigParam) MarshalJSON() (data []byte, err error) {
  1890  	type shadow BetaBrowserTripleClickConfigParam
  1891  	return param.MarshalObject(r, (*shadow)(&r))
  1892  }
  1893  func (r *BetaBrowserTripleClickConfigParam) UnmarshalJSON(data []byte) error {
  1894  	return apijson.UnmarshalRoot(data, r)
  1895  }
  1896  
  1897  // `type`'s config overrides.
  1898  type BetaBrowserTypeConfigParam struct {
  1899  	// Defer loading for this member. Must resolve to the same value on every enabled
  1900  	// member of the toolset.
  1901  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1902  	// Whether this member is offered to the model. Default is per member, per the
  1903  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1904  	// the served schema.
  1905  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1906  	paramObj
  1907  }
  1908  
  1909  func (r BetaBrowserTypeConfigParam) MarshalJSON() (data []byte, err error) {
  1910  	type shadow BetaBrowserTypeConfigParam
  1911  	return param.MarshalObject(r, (*shadow)(&r))
  1912  }
  1913  func (r *BetaBrowserTypeConfigParam) UnmarshalJSON(data []byte) error {
  1914  	return apijson.UnmarshalRoot(data, r)
  1915  }
  1916  
  1917  // `wait`'s config overrides.
  1918  type BetaBrowserWaitConfigParam struct {
  1919  	// Defer loading for this member. Must resolve to the same value on every enabled
  1920  	// member of the toolset.
  1921  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1922  	// Whether this member is offered to the model. Default is per member, per the
  1923  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1924  	// the served schema.
  1925  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1926  	paramObj
  1927  }
  1928  
  1929  func (r BetaBrowserWaitConfigParam) MarshalJSON() (data []byte, err error) {
  1930  	type shadow BetaBrowserWaitConfigParam
  1931  	return param.MarshalObject(r, (*shadow)(&r))
  1932  }
  1933  func (r *BetaBrowserWaitConfigParam) UnmarshalJSON(data []byte) error {
  1934  	return apijson.UnmarshalRoot(data, r)
  1935  }
  1936  
  1937  // `zoom`'s config overrides.
  1938  type BetaBrowserZoomConfigParam struct {
  1939  	// Defer loading for this member. Must resolve to the same value on every enabled
  1940  	// member of the toolset.
  1941  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  1942  	// Whether this member is offered to the model. Default is per member, per the
  1943  	// toolset's documentation. A member whose enabled resolves false is withheld from
  1944  	// the served schema.
  1945  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  1946  	paramObj
  1947  }
  1948  
  1949  func (r BetaBrowserZoomConfigParam) MarshalJSON() (data []byte, err error) {
  1950  	type shadow BetaBrowserZoomConfigParam
  1951  	return param.MarshalObject(r, (*shadow)(&r))
  1952  }
  1953  func (r *BetaBrowserZoomConfigParam) UnmarshalJSON(data []byte) error {
  1954  	return apijson.UnmarshalRoot(data, r)
  1955  }
  1956  
  1957  func NewBetaCacheControlEphemeralParam() BetaCacheControlEphemeralParam {
  1958  	return BetaCacheControlEphemeralParam{
  1959  		Type: "ephemeral",
  1960  	}
  1961  }
  1962  
  1963  // This struct has a constant value, construct it with
  1964  // [NewBetaCacheControlEphemeralParam].
  1965  type BetaCacheControlEphemeralParam struct {
  1966  	// The time-to-live for the cache control breakpoint.
  1967  	//
  1968  	// This may be one the following values:
  1969  	//
  1970  	// - `5m`: 5 minutes
  1971  	// - `1h`: 1 hour
  1972  	//
  1973  	// Defaults to `5m`. See
  1974  	// [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
  1975  	// for details.
  1976  	//
  1977  	// Any of "5m", "1h".
  1978  	TTL  BetaCacheControlEphemeralTTL `json:"ttl,omitzero"`
  1979  	Type constant.Ephemeral           `json:"type" default:"ephemeral"`
  1980  	paramObj
  1981  }
  1982  
  1983  func (r BetaCacheControlEphemeralParam) MarshalJSON() (data []byte, err error) {
  1984  	type shadow BetaCacheControlEphemeralParam
  1985  	return param.MarshalObject(r, (*shadow)(&r))
  1986  }
  1987  func (r *BetaCacheControlEphemeralParam) UnmarshalJSON(data []byte) error {
  1988  	return apijson.UnmarshalRoot(data, r)
  1989  }
  1990  
  1991  // The time-to-live for the cache control breakpoint.
  1992  //
  1993  // This may be one the following values:
  1994  //
  1995  // - `5m`: 5 minutes
  1996  // - `1h`: 1 hour
  1997  //
  1998  // Defaults to `5m`. See
  1999  // [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
  2000  // for details.
  2001  type BetaCacheControlEphemeralTTL string
  2002  
  2003  const (
  2004  	BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m"
  2005  	BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h"
  2006  )
  2007  
  2008  type BetaCacheCreation struct {
  2009  	// The number of input tokens used to create the 1 hour cache entry.
  2010  	Ephemeral1hInputTokens int64 `json:"ephemeral_1h_input_tokens" api:"required"`
  2011  	// The number of input tokens used to create the 5 minute cache entry.
  2012  	Ephemeral5mInputTokens int64 `json:"ephemeral_5m_input_tokens" api:"required"`
  2013  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2014  	JSON struct {
  2015  		Ephemeral1hInputTokens respjson.Field
  2016  		Ephemeral5mInputTokens respjson.Field
  2017  		ExtraFields            map[string]respjson.Field
  2018  		raw                    string
  2019  	} `json:"-"`
  2020  }
  2021  
  2022  // Returns the unmodified JSON received from the API
  2023  func (r BetaCacheCreation) RawJSON() string { return r.JSON.raw }
  2024  func (r *BetaCacheCreation) UnmarshalJSON(data []byte) error {
  2025  	return apijson.UnmarshalRoot(data, r)
  2026  }
  2027  
  2028  type BetaCacheMissMessagesChanged struct {
  2029  	// Approximate number of input tokens that would have been read from cache had the
  2030  	// prefix matched the previous request.
  2031  	CacheMissedInputTokens int64                    `json:"cache_missed_input_tokens" api:"required"`
  2032  	Type                   constant.MessagesChanged `json:"type" default:"messages_changed"`
  2033  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2034  	JSON struct {
  2035  		CacheMissedInputTokens respjson.Field
  2036  		Type                   respjson.Field
  2037  		ExtraFields            map[string]respjson.Field
  2038  		raw                    string
  2039  	} `json:"-"`
  2040  }
  2041  
  2042  // Returns the unmodified JSON received from the API
  2043  func (r BetaCacheMissMessagesChanged) RawJSON() string { return r.JSON.raw }
  2044  func (r *BetaCacheMissMessagesChanged) UnmarshalJSON(data []byte) error {
  2045  	return apijson.UnmarshalRoot(data, r)
  2046  }
  2047  
  2048  type BetaCacheMissModelChanged struct {
  2049  	// Approximate number of input tokens that would have been read from cache had the
  2050  	// prefix matched the previous request.
  2051  	CacheMissedInputTokens int64                 `json:"cache_missed_input_tokens" api:"required"`
  2052  	Type                   constant.ModelChanged `json:"type" default:"model_changed"`
  2053  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2054  	JSON struct {
  2055  		CacheMissedInputTokens respjson.Field
  2056  		Type                   respjson.Field
  2057  		ExtraFields            map[string]respjson.Field
  2058  		raw                    string
  2059  	} `json:"-"`
  2060  }
  2061  
  2062  // Returns the unmodified JSON received from the API
  2063  func (r BetaCacheMissModelChanged) RawJSON() string { return r.JSON.raw }
  2064  func (r *BetaCacheMissModelChanged) UnmarshalJSON(data []byte) error {
  2065  	return apijson.UnmarshalRoot(data, r)
  2066  }
  2067  
  2068  type BetaCacheMissPreviousMessageNotFound struct {
  2069  	Type constant.PreviousMessageNotFound `json:"type" default:"previous_message_not_found"`
  2070  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2071  	JSON struct {
  2072  		Type        respjson.Field
  2073  		ExtraFields map[string]respjson.Field
  2074  		raw         string
  2075  	} `json:"-"`
  2076  }
  2077  
  2078  // Returns the unmodified JSON received from the API
  2079  func (r BetaCacheMissPreviousMessageNotFound) RawJSON() string { return r.JSON.raw }
  2080  func (r *BetaCacheMissPreviousMessageNotFound) UnmarshalJSON(data []byte) error {
  2081  	return apijson.UnmarshalRoot(data, r)
  2082  }
  2083  
  2084  type BetaCacheMissSystemChanged struct {
  2085  	// Approximate number of input tokens that would have been read from cache had the
  2086  	// prefix matched the previous request.
  2087  	CacheMissedInputTokens int64                  `json:"cache_missed_input_tokens" api:"required"`
  2088  	Type                   constant.SystemChanged `json:"type" default:"system_changed"`
  2089  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2090  	JSON struct {
  2091  		CacheMissedInputTokens respjson.Field
  2092  		Type                   respjson.Field
  2093  		ExtraFields            map[string]respjson.Field
  2094  		raw                    string
  2095  	} `json:"-"`
  2096  }
  2097  
  2098  // Returns the unmodified JSON received from the API
  2099  func (r BetaCacheMissSystemChanged) RawJSON() string { return r.JSON.raw }
  2100  func (r *BetaCacheMissSystemChanged) UnmarshalJSON(data []byte) error {
  2101  	return apijson.UnmarshalRoot(data, r)
  2102  }
  2103  
  2104  type BetaCacheMissToolsChanged struct {
  2105  	// Approximate number of input tokens that would have been read from cache had the
  2106  	// prefix matched the previous request.
  2107  	CacheMissedInputTokens int64                 `json:"cache_missed_input_tokens" api:"required"`
  2108  	Type                   constant.ToolsChanged `json:"type" default:"tools_changed"`
  2109  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2110  	JSON struct {
  2111  		CacheMissedInputTokens respjson.Field
  2112  		Type                   respjson.Field
  2113  		ExtraFields            map[string]respjson.Field
  2114  		raw                    string
  2115  	} `json:"-"`
  2116  }
  2117  
  2118  // Returns the unmodified JSON received from the API
  2119  func (r BetaCacheMissToolsChanged) RawJSON() string { return r.JSON.raw }
  2120  func (r *BetaCacheMissToolsChanged) UnmarshalJSON(data []byte) error {
  2121  	return apijson.UnmarshalRoot(data, r)
  2122  }
  2123  
  2124  type BetaCacheMissUnavailable struct {
  2125  	Type constant.Unavailable `json:"type" default:"unavailable"`
  2126  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2127  	JSON struct {
  2128  		Type        respjson.Field
  2129  		ExtraFields map[string]respjson.Field
  2130  		raw         string
  2131  	} `json:"-"`
  2132  }
  2133  
  2134  // Returns the unmodified JSON received from the API
  2135  func (r BetaCacheMissUnavailable) RawJSON() string { return r.JSON.raw }
  2136  func (r *BetaCacheMissUnavailable) UnmarshalJSON(data []byte) error {
  2137  	return apijson.UnmarshalRoot(data, r)
  2138  }
  2139  
  2140  type BetaCitationCharLocation struct {
  2141  	CitedText      string                `json:"cited_text" api:"required"`
  2142  	DocumentIndex  int64                 `json:"document_index" api:"required"`
  2143  	DocumentTitle  string                `json:"document_title" api:"required"`
  2144  	EndCharIndex   int64                 `json:"end_char_index" api:"required"`
  2145  	FileID         string                `json:"file_id" api:"required"`
  2146  	StartCharIndex int64                 `json:"start_char_index" api:"required"`
  2147  	Type           constant.CharLocation `json:"type" default:"char_location"`
  2148  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2149  	JSON struct {
  2150  		CitedText      respjson.Field
  2151  		DocumentIndex  respjson.Field
  2152  		DocumentTitle  respjson.Field
  2153  		EndCharIndex   respjson.Field
  2154  		FileID         respjson.Field
  2155  		StartCharIndex respjson.Field
  2156  		Type           respjson.Field
  2157  		ExtraFields    map[string]respjson.Field
  2158  		raw            string
  2159  	} `json:"-"`
  2160  }
  2161  
  2162  // Returns the unmodified JSON received from the API
  2163  func (r BetaCitationCharLocation) RawJSON() string { return r.JSON.raw }
  2164  func (r *BetaCitationCharLocation) UnmarshalJSON(data []byte) error {
  2165  	return apijson.UnmarshalRoot(data, r)
  2166  }
  2167  
  2168  // The properties CitedText, DocumentIndex, DocumentTitle, EndCharIndex,
  2169  // StartCharIndex, Type are required.
  2170  type BetaCitationCharLocationParam struct {
  2171  	DocumentTitle  param.Opt[string] `json:"document_title,omitzero" api:"required"`
  2172  	CitedText      string            `json:"cited_text" api:"required"`
  2173  	DocumentIndex  int64             `json:"document_index" api:"required"`
  2174  	EndCharIndex   int64             `json:"end_char_index" api:"required"`
  2175  	StartCharIndex int64             `json:"start_char_index" api:"required"`
  2176  	// This field can be elided, and will marshal its zero value as "char_location".
  2177  	Type constant.CharLocation `json:"type" default:"char_location"`
  2178  	paramObj
  2179  }
  2180  
  2181  func (r BetaCitationCharLocationParam) MarshalJSON() (data []byte, err error) {
  2182  	type shadow BetaCitationCharLocationParam
  2183  	return param.MarshalObject(r, (*shadow)(&r))
  2184  }
  2185  func (r *BetaCitationCharLocationParam) UnmarshalJSON(data []byte) error {
  2186  	return apijson.UnmarshalRoot(data, r)
  2187  }
  2188  
  2189  type BetaCitationConfig struct {
  2190  	Enabled bool `json:"enabled" api:"required"`
  2191  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2192  	JSON struct {
  2193  		Enabled     respjson.Field
  2194  		ExtraFields map[string]respjson.Field
  2195  		raw         string
  2196  	} `json:"-"`
  2197  }
  2198  
  2199  // Returns the unmodified JSON received from the API
  2200  func (r BetaCitationConfig) RawJSON() string { return r.JSON.raw }
  2201  func (r *BetaCitationConfig) UnmarshalJSON(data []byte) error {
  2202  	return apijson.UnmarshalRoot(data, r)
  2203  }
  2204  
  2205  type BetaCitationContentBlockLocation struct {
  2206  	// The full text of the cited block range, concatenated.
  2207  	//
  2208  	// Always equals the contents of `content[start_block_index:end_block_index]`
  2209  	// joined together. The text block is the minimal citable unit; this field is never
  2210  	// a substring of a single block. Not counted toward output tokens, and not counted
  2211  	// toward input tokens when sent back in subsequent turns.
  2212  	CitedText     string `json:"cited_text" api:"required"`
  2213  	DocumentIndex int64  `json:"document_index" api:"required"`
  2214  	DocumentTitle string `json:"document_title" api:"required"`
  2215  	// Exclusive 0-based end index of the cited block range in the source's `content`
  2216  	// array.
  2217  	//
  2218  	// Always greater than `start_block_index`; a single-block citation has
  2219  	// `end_block_index = start_block_index + 1`.
  2220  	EndBlockIndex int64  `json:"end_block_index" api:"required"`
  2221  	FileID        string `json:"file_id" api:"required"`
  2222  	// 0-based index of the first cited block in the source's `content` array.
  2223  	StartBlockIndex int64                         `json:"start_block_index" api:"required"`
  2224  	Type            constant.ContentBlockLocation `json:"type" default:"content_block_location"`
  2225  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2226  	JSON struct {
  2227  		CitedText       respjson.Field
  2228  		DocumentIndex   respjson.Field
  2229  		DocumentTitle   respjson.Field
  2230  		EndBlockIndex   respjson.Field
  2231  		FileID          respjson.Field
  2232  		StartBlockIndex respjson.Field
  2233  		Type            respjson.Field
  2234  		ExtraFields     map[string]respjson.Field
  2235  		raw             string
  2236  	} `json:"-"`
  2237  }
  2238  
  2239  // Returns the unmodified JSON received from the API
  2240  func (r BetaCitationContentBlockLocation) RawJSON() string { return r.JSON.raw }
  2241  func (r *BetaCitationContentBlockLocation) UnmarshalJSON(data []byte) error {
  2242  	return apijson.UnmarshalRoot(data, r)
  2243  }
  2244  
  2245  // The properties CitedText, DocumentIndex, DocumentTitle, EndBlockIndex,
  2246  // StartBlockIndex, Type are required.
  2247  type BetaCitationContentBlockLocationParam struct {
  2248  	DocumentTitle param.Opt[string] `json:"document_title,omitzero" api:"required"`
  2249  	// The full text of the cited block range, concatenated.
  2250  	//
  2251  	// Always equals the contents of `content[start_block_index:end_block_index]`
  2252  	// joined together. The text block is the minimal citable unit; this field is never
  2253  	// a substring of a single block. Not counted toward output tokens, and not counted
  2254  	// toward input tokens when sent back in subsequent turns.
  2255  	CitedText     string `json:"cited_text" api:"required"`
  2256  	DocumentIndex int64  `json:"document_index" api:"required"`
  2257  	// Exclusive 0-based end index of the cited block range in the source's `content`
  2258  	// array.
  2259  	//
  2260  	// Always greater than `start_block_index`; a single-block citation has
  2261  	// `end_block_index = start_block_index + 1`.
  2262  	EndBlockIndex int64 `json:"end_block_index" api:"required"`
  2263  	// 0-based index of the first cited block in the source's `content` array.
  2264  	StartBlockIndex int64 `json:"start_block_index" api:"required"`
  2265  	// This field can be elided, and will marshal its zero value as
  2266  	// "content_block_location".
  2267  	Type constant.ContentBlockLocation `json:"type" default:"content_block_location"`
  2268  	paramObj
  2269  }
  2270  
  2271  func (r BetaCitationContentBlockLocationParam) MarshalJSON() (data []byte, err error) {
  2272  	type shadow BetaCitationContentBlockLocationParam
  2273  	return param.MarshalObject(r, (*shadow)(&r))
  2274  }
  2275  func (r *BetaCitationContentBlockLocationParam) UnmarshalJSON(data []byte) error {
  2276  	return apijson.UnmarshalRoot(data, r)
  2277  }
  2278  
  2279  type BetaCitationPageLocation struct {
  2280  	CitedText       string                `json:"cited_text" api:"required"`
  2281  	DocumentIndex   int64                 `json:"document_index" api:"required"`
  2282  	DocumentTitle   string                `json:"document_title" api:"required"`
  2283  	EndPageNumber   int64                 `json:"end_page_number" api:"required"`
  2284  	FileID          string                `json:"file_id" api:"required"`
  2285  	StartPageNumber int64                 `json:"start_page_number" api:"required"`
  2286  	Type            constant.PageLocation `json:"type" default:"page_location"`
  2287  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2288  	JSON struct {
  2289  		CitedText       respjson.Field
  2290  		DocumentIndex   respjson.Field
  2291  		DocumentTitle   respjson.Field
  2292  		EndPageNumber   respjson.Field
  2293  		FileID          respjson.Field
  2294  		StartPageNumber respjson.Field
  2295  		Type            respjson.Field
  2296  		ExtraFields     map[string]respjson.Field
  2297  		raw             string
  2298  	} `json:"-"`
  2299  }
  2300  
  2301  // Returns the unmodified JSON received from the API
  2302  func (r BetaCitationPageLocation) RawJSON() string { return r.JSON.raw }
  2303  func (r *BetaCitationPageLocation) UnmarshalJSON(data []byte) error {
  2304  	return apijson.UnmarshalRoot(data, r)
  2305  }
  2306  
  2307  // The properties CitedText, DocumentIndex, DocumentTitle, EndPageNumber,
  2308  // StartPageNumber, Type are required.
  2309  type BetaCitationPageLocationParam struct {
  2310  	DocumentTitle   param.Opt[string] `json:"document_title,omitzero" api:"required"`
  2311  	CitedText       string            `json:"cited_text" api:"required"`
  2312  	DocumentIndex   int64             `json:"document_index" api:"required"`
  2313  	EndPageNumber   int64             `json:"end_page_number" api:"required"`
  2314  	StartPageNumber int64             `json:"start_page_number" api:"required"`
  2315  	// This field can be elided, and will marshal its zero value as "page_location".
  2316  	Type constant.PageLocation `json:"type" default:"page_location"`
  2317  	paramObj
  2318  }
  2319  
  2320  func (r BetaCitationPageLocationParam) MarshalJSON() (data []byte, err error) {
  2321  	type shadow BetaCitationPageLocationParam
  2322  	return param.MarshalObject(r, (*shadow)(&r))
  2323  }
  2324  func (r *BetaCitationPageLocationParam) UnmarshalJSON(data []byte) error {
  2325  	return apijson.UnmarshalRoot(data, r)
  2326  }
  2327  
  2328  type BetaCitationSearchResultLocation struct {
  2329  	// The full text of the cited block range, concatenated.
  2330  	//
  2331  	// Always equals the contents of `content[start_block_index:end_block_index]`
  2332  	// joined together. The text block is the minimal citable unit; this field is never
  2333  	// a substring of a single block. Not counted toward output tokens, and not counted
  2334  	// toward input tokens when sent back in subsequent turns.
  2335  	CitedText string `json:"cited_text" api:"required"`
  2336  	// Exclusive 0-based end index of the cited block range in the source's `content`
  2337  	// array.
  2338  	//
  2339  	// Always greater than `start_block_index`; a single-block citation has
  2340  	// `end_block_index = start_block_index + 1`.
  2341  	EndBlockIndex int64 `json:"end_block_index" api:"required"`
  2342  	// 0-based index of the cited search result among all `search_result` content
  2343  	// blocks in the request, in the order they appear across messages and tool
  2344  	// results.
  2345  	//
  2346  	// Counted separately from `document_index`; server-side web search results are not
  2347  	// included in this count.
  2348  	SearchResultIndex int64  `json:"search_result_index" api:"required"`
  2349  	Source            string `json:"source" api:"required"`
  2350  	// 0-based index of the first cited block in the source's `content` array.
  2351  	StartBlockIndex int64                         `json:"start_block_index" api:"required"`
  2352  	Title           string                        `json:"title" api:"required"`
  2353  	Type            constant.SearchResultLocation `json:"type" default:"search_result_location"`
  2354  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2355  	JSON struct {
  2356  		CitedText         respjson.Field
  2357  		EndBlockIndex     respjson.Field
  2358  		SearchResultIndex respjson.Field
  2359  		Source            respjson.Field
  2360  		StartBlockIndex   respjson.Field
  2361  		Title             respjson.Field
  2362  		Type              respjson.Field
  2363  		ExtraFields       map[string]respjson.Field
  2364  		raw               string
  2365  	} `json:"-"`
  2366  }
  2367  
  2368  // Returns the unmodified JSON received from the API
  2369  func (r BetaCitationSearchResultLocation) RawJSON() string { return r.JSON.raw }
  2370  func (r *BetaCitationSearchResultLocation) UnmarshalJSON(data []byte) error {
  2371  	return apijson.UnmarshalRoot(data, r)
  2372  }
  2373  
  2374  // The properties CitedText, EndBlockIndex, SearchResultIndex, Source,
  2375  // StartBlockIndex, Title, Type are required.
  2376  type BetaCitationSearchResultLocationParam struct {
  2377  	Title param.Opt[string] `json:"title,omitzero" api:"required"`
  2378  	// The full text of the cited block range, concatenated.
  2379  	//
  2380  	// Always equals the contents of `content[start_block_index:end_block_index]`
  2381  	// joined together. The text block is the minimal citable unit; this field is never
  2382  	// a substring of a single block. Not counted toward output tokens, and not counted
  2383  	// toward input tokens when sent back in subsequent turns.
  2384  	CitedText string `json:"cited_text" api:"required"`
  2385  	// Exclusive 0-based end index of the cited block range in the source's `content`
  2386  	// array.
  2387  	//
  2388  	// Always greater than `start_block_index`; a single-block citation has
  2389  	// `end_block_index = start_block_index + 1`.
  2390  	EndBlockIndex int64 `json:"end_block_index" api:"required"`
  2391  	// 0-based index of the cited search result among all `search_result` content
  2392  	// blocks in the request, in the order they appear across messages and tool
  2393  	// results.
  2394  	//
  2395  	// Counted separately from `document_index`; server-side web search results are not
  2396  	// included in this count.
  2397  	SearchResultIndex int64  `json:"search_result_index" api:"required"`
  2398  	Source            string `json:"source" api:"required"`
  2399  	// 0-based index of the first cited block in the source's `content` array.
  2400  	StartBlockIndex int64 `json:"start_block_index" api:"required"`
  2401  	// This field can be elided, and will marshal its zero value as
  2402  	// "search_result_location".
  2403  	Type constant.SearchResultLocation `json:"type" default:"search_result_location"`
  2404  	paramObj
  2405  }
  2406  
  2407  func (r BetaCitationSearchResultLocationParam) MarshalJSON() (data []byte, err error) {
  2408  	type shadow BetaCitationSearchResultLocationParam
  2409  	return param.MarshalObject(r, (*shadow)(&r))
  2410  }
  2411  func (r *BetaCitationSearchResultLocationParam) UnmarshalJSON(data []byte) error {
  2412  	return apijson.UnmarshalRoot(data, r)
  2413  }
  2414  
  2415  // The properties CitedText, EncryptedIndex, Title, Type, URL are required.
  2416  type BetaCitationWebSearchResultLocationParam struct {
  2417  	Title          param.Opt[string] `json:"title,omitzero" api:"required"`
  2418  	CitedText      string            `json:"cited_text" api:"required"`
  2419  	EncryptedIndex string            `json:"encrypted_index" api:"required"`
  2420  	URL            string            `json:"url" api:"required"`
  2421  	// This field can be elided, and will marshal its zero value as
  2422  	// "web_search_result_location".
  2423  	Type constant.WebSearchResultLocation `json:"type" default:"web_search_result_location"`
  2424  	paramObj
  2425  }
  2426  
  2427  func (r BetaCitationWebSearchResultLocationParam) MarshalJSON() (data []byte, err error) {
  2428  	type shadow BetaCitationWebSearchResultLocationParam
  2429  	return param.MarshalObject(r, (*shadow)(&r))
  2430  }
  2431  func (r *BetaCitationWebSearchResultLocationParam) UnmarshalJSON(data []byte) error {
  2432  	return apijson.UnmarshalRoot(data, r)
  2433  }
  2434  
  2435  type BetaCitationsConfigParam struct {
  2436  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  2437  	paramObj
  2438  }
  2439  
  2440  func (r BetaCitationsConfigParam) MarshalJSON() (data []byte, err error) {
  2441  	type shadow BetaCitationsConfigParam
  2442  	return param.MarshalObject(r, (*shadow)(&r))
  2443  }
  2444  func (r *BetaCitationsConfigParam) UnmarshalJSON(data []byte) error {
  2445  	return apijson.UnmarshalRoot(data, r)
  2446  }
  2447  
  2448  type BetaCitationsDelta struct {
  2449  	Citation BetaCitationsDeltaCitationUnion `json:"citation" api:"required"`
  2450  	Type     constant.CitationsDelta         `json:"type" default:"citations_delta"`
  2451  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2452  	JSON struct {
  2453  		Citation    respjson.Field
  2454  		Type        respjson.Field
  2455  		ExtraFields map[string]respjson.Field
  2456  		raw         string
  2457  	} `json:"-"`
  2458  }
  2459  
  2460  // Returns the unmodified JSON received from the API
  2461  func (r BetaCitationsDelta) RawJSON() string { return r.JSON.raw }
  2462  func (r *BetaCitationsDelta) UnmarshalJSON(data []byte) error {
  2463  	return apijson.UnmarshalRoot(data, r)
  2464  }
  2465  
  2466  // BetaCitationsDeltaCitationUnion contains all possible properties and values from
  2467  // [BetaCitationCharLocation], [BetaCitationPageLocation],
  2468  // [BetaCitationContentBlockLocation], [BetaCitationsWebSearchResultLocation],
  2469  // [BetaCitationSearchResultLocation].
  2470  //
  2471  // Use the [BetaCitationsDeltaCitationUnion.AsAny] method to switch on the variant.
  2472  //
  2473  // Use the methods beginning with 'As' to cast the union to one of its variants.
  2474  type BetaCitationsDeltaCitationUnion struct {
  2475  	CitedText     string `json:"cited_text"`
  2476  	DocumentIndex int64  `json:"document_index"`
  2477  	DocumentTitle string `json:"document_title"`
  2478  	// This field is from variant [BetaCitationCharLocation].
  2479  	EndCharIndex int64  `json:"end_char_index"`
  2480  	FileID       string `json:"file_id"`
  2481  	// This field is from variant [BetaCitationCharLocation].
  2482  	StartCharIndex int64 `json:"start_char_index"`
  2483  	// Any of "char_location", "page_location", "content_block_location",
  2484  	// "web_search_result_location", "search_result_location".
  2485  	Type string `json:"type"`
  2486  	// This field is from variant [BetaCitationPageLocation].
  2487  	EndPageNumber int64 `json:"end_page_number"`
  2488  	// This field is from variant [BetaCitationPageLocation].
  2489  	StartPageNumber int64 `json:"start_page_number"`
  2490  	EndBlockIndex   int64 `json:"end_block_index"`
  2491  	StartBlockIndex int64 `json:"start_block_index"`
  2492  	// This field is from variant [BetaCitationsWebSearchResultLocation].
  2493  	EncryptedIndex string `json:"encrypted_index"`
  2494  	Title          string `json:"title"`
  2495  	// This field is from variant [BetaCitationsWebSearchResultLocation].
  2496  	URL string `json:"url"`
  2497  	// This field is from variant [BetaCitationSearchResultLocation].
  2498  	SearchResultIndex int64 `json:"search_result_index"`
  2499  	// This field is from variant [BetaCitationSearchResultLocation].
  2500  	Source string `json:"source"`
  2501  	JSON   struct {
  2502  		CitedText         respjson.Field
  2503  		DocumentIndex     respjson.Field
  2504  		DocumentTitle     respjson.Field
  2505  		EndCharIndex      respjson.Field
  2506  		FileID            respjson.Field
  2507  		StartCharIndex    respjson.Field
  2508  		Type              respjson.Field
  2509  		EndPageNumber     respjson.Field
  2510  		StartPageNumber   respjson.Field
  2511  		EndBlockIndex     respjson.Field
  2512  		StartBlockIndex   respjson.Field
  2513  		EncryptedIndex    respjson.Field
  2514  		Title             respjson.Field
  2515  		URL               respjson.Field
  2516  		SearchResultIndex respjson.Field
  2517  		Source            respjson.Field
  2518  		raw               string
  2519  	} `json:"-"`
  2520  }
  2521  
  2522  // anyBetaCitationsDeltaCitation is implemented by each variant of
  2523  // [BetaCitationsDeltaCitationUnion] to add type safety for the return type of
  2524  // [BetaCitationsDeltaCitationUnion.AsAny]
  2525  type anyBetaCitationsDeltaCitation interface {
  2526  	implBetaCitationsDeltaCitationUnion()
  2527  }
  2528  
  2529  func (BetaCitationCharLocation) implBetaCitationsDeltaCitationUnion()             {}
  2530  func (BetaCitationPageLocation) implBetaCitationsDeltaCitationUnion()             {}
  2531  func (BetaCitationContentBlockLocation) implBetaCitationsDeltaCitationUnion()     {}
  2532  func (BetaCitationsWebSearchResultLocation) implBetaCitationsDeltaCitationUnion() {}
  2533  func (BetaCitationSearchResultLocation) implBetaCitationsDeltaCitationUnion()     {}
  2534  
  2535  // Use the following switch statement to find the correct variant
  2536  //
  2537  //	switch variant := BetaCitationsDeltaCitationUnion.AsAny().(type) {
  2538  //	case anthropic.BetaCitationCharLocation:
  2539  //	case anthropic.BetaCitationPageLocation:
  2540  //	case anthropic.BetaCitationContentBlockLocation:
  2541  //	case anthropic.BetaCitationsWebSearchResultLocation:
  2542  //	case anthropic.BetaCitationSearchResultLocation:
  2543  //	default:
  2544  //	  fmt.Errorf("no variant present")
  2545  //	}
  2546  func (u BetaCitationsDeltaCitationUnion) AsAny() anyBetaCitationsDeltaCitation {
  2547  	switch u.Type {
  2548  	case "char_location":
  2549  		return u.AsCharLocation()
  2550  	case "page_location":
  2551  		return u.AsPageLocation()
  2552  	case "content_block_location":
  2553  		return u.AsContentBlockLocation()
  2554  	case "web_search_result_location":
  2555  		return u.AsWebSearchResultLocation()
  2556  	case "search_result_location":
  2557  		return u.AsSearchResultLocation()
  2558  	}
  2559  	return nil
  2560  }
  2561  
  2562  func (u BetaCitationsDeltaCitationUnion) AsCharLocation() (v BetaCitationCharLocation) {
  2563  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  2564  	return
  2565  }
  2566  
  2567  func (u BetaCitationsDeltaCitationUnion) AsPageLocation() (v BetaCitationPageLocation) {
  2568  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  2569  	return
  2570  }
  2571  
  2572  func (u BetaCitationsDeltaCitationUnion) AsContentBlockLocation() (v BetaCitationContentBlockLocation) {
  2573  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  2574  	return
  2575  }
  2576  
  2577  func (u BetaCitationsDeltaCitationUnion) AsWebSearchResultLocation() (v BetaCitationsWebSearchResultLocation) {
  2578  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  2579  	return
  2580  }
  2581  
  2582  func (u BetaCitationsDeltaCitationUnion) AsSearchResultLocation() (v BetaCitationSearchResultLocation) {
  2583  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  2584  	return
  2585  }
  2586  
  2587  // Returns the unmodified JSON received from the API
  2588  func (u BetaCitationsDeltaCitationUnion) RawJSON() string { return u.JSON.raw }
  2589  
  2590  func (r *BetaCitationsDeltaCitationUnion) UnmarshalJSON(data []byte) error {
  2591  	return apijson.UnmarshalRoot(data, r)
  2592  }
  2593  
  2594  type BetaCitationsWebSearchResultLocation struct {
  2595  	CitedText      string                           `json:"cited_text" api:"required"`
  2596  	EncryptedIndex string                           `json:"encrypted_index" api:"required"`
  2597  	Title          string                           `json:"title" api:"required"`
  2598  	Type           constant.WebSearchResultLocation `json:"type" default:"web_search_result_location"`
  2599  	URL            string                           `json:"url" api:"required"`
  2600  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2601  	JSON struct {
  2602  		CitedText      respjson.Field
  2603  		EncryptedIndex respjson.Field
  2604  		Title          respjson.Field
  2605  		Type           respjson.Field
  2606  		URL            respjson.Field
  2607  		ExtraFields    map[string]respjson.Field
  2608  		raw            string
  2609  	} `json:"-"`
  2610  }
  2611  
  2612  // Returns the unmodified JSON received from the API
  2613  func (r BetaCitationsWebSearchResultLocation) RawJSON() string { return r.JSON.raw }
  2614  func (r *BetaCitationsWebSearchResultLocation) UnmarshalJSON(data []byte) error {
  2615  	return apijson.UnmarshalRoot(data, r)
  2616  }
  2617  
  2618  // The property Type is required.
  2619  type BetaClearThinking20251015EditParam struct {
  2620  	// Number of most recent assistant turns to keep thinking blocks for. Older turns
  2621  	// will have their thinking blocks removed.
  2622  	Keep BetaClearThinking20251015EditKeepUnionParam `json:"keep,omitzero"`
  2623  	// This field can be elided, and will marshal its zero value as
  2624  	// "clear_thinking_20251015".
  2625  	Type constant.ClearThinking20251015 `json:"type" default:"clear_thinking_20251015"`
  2626  	paramObj
  2627  }
  2628  
  2629  func (r BetaClearThinking20251015EditParam) MarshalJSON() (data []byte, err error) {
  2630  	type shadow BetaClearThinking20251015EditParam
  2631  	return param.MarshalObject(r, (*shadow)(&r))
  2632  }
  2633  func (r *BetaClearThinking20251015EditParam) UnmarshalJSON(data []byte) error {
  2634  	return apijson.UnmarshalRoot(data, r)
  2635  }
  2636  
  2637  // Only one field can be non-zero.
  2638  //
  2639  // Use [param.IsOmitted] to confirm if a field is set.
  2640  type BetaClearThinking20251015EditKeepUnionParam struct {
  2641  	OfThinkingTurns    *BetaThinkingTurnsParam    `json:",omitzero,inline"`
  2642  	OfAllThinkingTurns *BetaAllThinkingTurnsParam `json:",omitzero,inline"`
  2643  	// Construct this variant with constant.ValueOf[constant.All]()
  2644  	OfAll constant.All `json:",omitzero,inline"`
  2645  	paramUnion
  2646  }
  2647  
  2648  func (u BetaClearThinking20251015EditKeepUnionParam) MarshalJSON() ([]byte, error) {
  2649  	return param.MarshalUnion(u, u.OfThinkingTurns, u.OfAllThinkingTurns, u.OfAll)
  2650  }
  2651  func (u *BetaClearThinking20251015EditKeepUnionParam) UnmarshalJSON(data []byte) error {
  2652  	return apijson.UnmarshalRoot(data, u)
  2653  }
  2654  
  2655  func (u *BetaClearThinking20251015EditKeepUnionParam) asAny() any {
  2656  	if !param.IsOmitted(u.OfThinkingTurns) {
  2657  		return u.OfThinkingTurns
  2658  	} else if !param.IsOmitted(u.OfAllThinkingTurns) {
  2659  		return u.OfAllThinkingTurns
  2660  	} else if !param.IsOmitted(u.OfAll) {
  2661  		return &u.OfAll
  2662  	}
  2663  	return nil
  2664  }
  2665  
  2666  // Returns a pointer to the underlying variant's property, if present.
  2667  func (u BetaClearThinking20251015EditKeepUnionParam) GetValue() *int64 {
  2668  	if vt := u.OfThinkingTurns; vt != nil {
  2669  		return &vt.Value
  2670  	}
  2671  	return nil
  2672  }
  2673  
  2674  // Returns a pointer to the underlying variant's property, if present.
  2675  func (u BetaClearThinking20251015EditKeepUnionParam) GetType() *string {
  2676  	if vt := u.OfThinkingTurns; vt != nil {
  2677  		return (*string)(&vt.Type)
  2678  	} else if vt := u.OfAllThinkingTurns; vt != nil {
  2679  		return (*string)(&vt.Type)
  2680  	}
  2681  	return nil
  2682  }
  2683  
  2684  type BetaClearThinking20251015EditResponse struct {
  2685  	// Number of input tokens cleared by this edit.
  2686  	ClearedInputTokens int64 `json:"cleared_input_tokens" api:"required"`
  2687  	// Number of thinking turns that were cleared.
  2688  	ClearedThinkingTurns int64 `json:"cleared_thinking_turns" api:"required"`
  2689  	// The type of context management edit applied.
  2690  	Type constant.ClearThinking20251015 `json:"type" default:"clear_thinking_20251015"`
  2691  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2692  	JSON struct {
  2693  		ClearedInputTokens   respjson.Field
  2694  		ClearedThinkingTurns respjson.Field
  2695  		Type                 respjson.Field
  2696  		ExtraFields          map[string]respjson.Field
  2697  		raw                  string
  2698  	} `json:"-"`
  2699  }
  2700  
  2701  // Returns the unmodified JSON received from the API
  2702  func (r BetaClearThinking20251015EditResponse) RawJSON() string { return r.JSON.raw }
  2703  func (r *BetaClearThinking20251015EditResponse) UnmarshalJSON(data []byte) error {
  2704  	return apijson.UnmarshalRoot(data, r)
  2705  }
  2706  
  2707  // The property Type is required.
  2708  type BetaClearToolUses20250919EditParam struct {
  2709  	// Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)
  2710  	ClearToolInputs BetaClearToolUses20250919EditClearToolInputsUnionParam `json:"clear_tool_inputs,omitzero"`
  2711  	// Tool names whose uses are preserved from clearing
  2712  	ExcludeTools []string `json:"exclude_tools,omitzero"`
  2713  	// Minimum number of tokens that must be cleared when triggered. Context will only
  2714  	// be modified if at least this many tokens can be removed.
  2715  	ClearAtLeast BetaInputTokensClearAtLeastParam `json:"clear_at_least,omitzero"`
  2716  	// Number of tool uses to retain in the conversation
  2717  	Keep BetaToolUsesKeepParam `json:"keep,omitzero"`
  2718  	// Condition that triggers the context management strategy
  2719  	Trigger BetaClearToolUses20250919EditTriggerUnionParam `json:"trigger,omitzero"`
  2720  	// This field can be elided, and will marshal its zero value as
  2721  	// "clear_tool_uses_20250919".
  2722  	Type constant.ClearToolUses20250919 `json:"type" default:"clear_tool_uses_20250919"`
  2723  	paramObj
  2724  }
  2725  
  2726  func (r BetaClearToolUses20250919EditParam) MarshalJSON() (data []byte, err error) {
  2727  	type shadow BetaClearToolUses20250919EditParam
  2728  	return param.MarshalObject(r, (*shadow)(&r))
  2729  }
  2730  func (r *BetaClearToolUses20250919EditParam) UnmarshalJSON(data []byte) error {
  2731  	return apijson.UnmarshalRoot(data, r)
  2732  }
  2733  
  2734  // Only one field can be non-zero.
  2735  //
  2736  // Use [param.IsOmitted] to confirm if a field is set.
  2737  type BetaClearToolUses20250919EditClearToolInputsUnionParam struct {
  2738  	OfBool        param.Opt[bool] `json:",omitzero,inline"`
  2739  	OfStringArray []string        `json:",omitzero,inline"`
  2740  	paramUnion
  2741  }
  2742  
  2743  func (u BetaClearToolUses20250919EditClearToolInputsUnionParam) MarshalJSON() ([]byte, error) {
  2744  	return param.MarshalUnion(u, u.OfBool, u.OfStringArray)
  2745  }
  2746  func (u *BetaClearToolUses20250919EditClearToolInputsUnionParam) UnmarshalJSON(data []byte) error {
  2747  	return apijson.UnmarshalRoot(data, u)
  2748  }
  2749  
  2750  func (u *BetaClearToolUses20250919EditClearToolInputsUnionParam) asAny() any {
  2751  	if !param.IsOmitted(u.OfBool) {
  2752  		return &u.OfBool.Value
  2753  	} else if !param.IsOmitted(u.OfStringArray) {
  2754  		return &u.OfStringArray
  2755  	}
  2756  	return nil
  2757  }
  2758  
  2759  // Only one field can be non-zero.
  2760  //
  2761  // Use [param.IsOmitted] to confirm if a field is set.
  2762  type BetaClearToolUses20250919EditTriggerUnionParam struct {
  2763  	OfInputTokens *BetaInputTokensTriggerParam `json:",omitzero,inline"`
  2764  	OfToolUses    *BetaToolUsesTriggerParam    `json:",omitzero,inline"`
  2765  	paramUnion
  2766  }
  2767  
  2768  func (u BetaClearToolUses20250919EditTriggerUnionParam) MarshalJSON() ([]byte, error) {
  2769  	return param.MarshalUnion(u, u.OfInputTokens, u.OfToolUses)
  2770  }
  2771  func (u *BetaClearToolUses20250919EditTriggerUnionParam) UnmarshalJSON(data []byte) error {
  2772  	return apijson.UnmarshalRoot(data, u)
  2773  }
  2774  
  2775  func (u *BetaClearToolUses20250919EditTriggerUnionParam) asAny() any {
  2776  	if !param.IsOmitted(u.OfInputTokens) {
  2777  		return u.OfInputTokens
  2778  	} else if !param.IsOmitted(u.OfToolUses) {
  2779  		return u.OfToolUses
  2780  	}
  2781  	return nil
  2782  }
  2783  
  2784  // Returns a pointer to the underlying variant's property, if present.
  2785  func (u BetaClearToolUses20250919EditTriggerUnionParam) GetType() *string {
  2786  	if vt := u.OfInputTokens; vt != nil {
  2787  		return (*string)(&vt.Type)
  2788  	} else if vt := u.OfToolUses; vt != nil {
  2789  		return (*string)(&vt.Type)
  2790  	}
  2791  	return nil
  2792  }
  2793  
  2794  // Returns a pointer to the underlying variant's property, if present.
  2795  func (u BetaClearToolUses20250919EditTriggerUnionParam) GetValue() *int64 {
  2796  	if vt := u.OfInputTokens; vt != nil {
  2797  		return (*int64)(&vt.Value)
  2798  	} else if vt := u.OfToolUses; vt != nil {
  2799  		return (*int64)(&vt.Value)
  2800  	}
  2801  	return nil
  2802  }
  2803  
  2804  func init() {
  2805  	apijson.RegisterUnion[BetaClearToolUses20250919EditTriggerUnionParam](
  2806  		"type",
  2807  		apijson.Discriminator[BetaInputTokensTriggerParam]("input_tokens"),
  2808  		apijson.Discriminator[BetaToolUsesTriggerParam]("tool_uses"),
  2809  	)
  2810  }
  2811  
  2812  type BetaClearToolUses20250919EditResponse struct {
  2813  	// Number of input tokens cleared by this edit.
  2814  	ClearedInputTokens int64 `json:"cleared_input_tokens" api:"required"`
  2815  	// Number of tool uses that were cleared.
  2816  	ClearedToolUses int64 `json:"cleared_tool_uses" api:"required"`
  2817  	// The type of context management edit applied.
  2818  	Type constant.ClearToolUses20250919 `json:"type" default:"clear_tool_uses_20250919"`
  2819  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2820  	JSON struct {
  2821  		ClearedInputTokens respjson.Field
  2822  		ClearedToolUses    respjson.Field
  2823  		Type               respjson.Field
  2824  		ExtraFields        map[string]respjson.Field
  2825  		raw                string
  2826  	} `json:"-"`
  2827  }
  2828  
  2829  // Returns the unmodified JSON received from the API
  2830  func (r BetaClearToolUses20250919EditResponse) RawJSON() string { return r.JSON.raw }
  2831  func (r *BetaClearToolUses20250919EditResponse) UnmarshalJSON(data []byte) error {
  2832  	return apijson.UnmarshalRoot(data, r)
  2833  }
  2834  
  2835  type BetaCodeExecutionOutputBlock struct {
  2836  	FileID string                       `json:"file_id" api:"required"`
  2837  	Type   constant.CodeExecutionOutput `json:"type" default:"code_execution_output"`
  2838  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2839  	JSON struct {
  2840  		FileID      respjson.Field
  2841  		Type        respjson.Field
  2842  		ExtraFields map[string]respjson.Field
  2843  		raw         string
  2844  	} `json:"-"`
  2845  }
  2846  
  2847  // Returns the unmodified JSON received from the API
  2848  func (r BetaCodeExecutionOutputBlock) RawJSON() string { return r.JSON.raw }
  2849  func (r *BetaCodeExecutionOutputBlock) UnmarshalJSON(data []byte) error {
  2850  	return apijson.UnmarshalRoot(data, r)
  2851  }
  2852  
  2853  // The properties FileID, Type are required.
  2854  type BetaCodeExecutionOutputBlockParam struct {
  2855  	FileID string `json:"file_id" api:"required"`
  2856  	// This field can be elided, and will marshal its zero value as
  2857  	// "code_execution_output".
  2858  	Type constant.CodeExecutionOutput `json:"type" default:"code_execution_output"`
  2859  	paramObj
  2860  }
  2861  
  2862  func (r BetaCodeExecutionOutputBlockParam) MarshalJSON() (data []byte, err error) {
  2863  	type shadow BetaCodeExecutionOutputBlockParam
  2864  	return param.MarshalObject(r, (*shadow)(&r))
  2865  }
  2866  func (r *BetaCodeExecutionOutputBlockParam) UnmarshalJSON(data []byte) error {
  2867  	return apijson.UnmarshalRoot(data, r)
  2868  }
  2869  
  2870  type BetaCodeExecutionResultBlock struct {
  2871  	Content    []BetaCodeExecutionOutputBlock `json:"content" api:"required"`
  2872  	ReturnCode int64                          `json:"return_code" api:"required"`
  2873  	Stderr     string                         `json:"stderr" api:"required"`
  2874  	Stdout     string                         `json:"stdout" api:"required"`
  2875  	Type       constant.CodeExecutionResult   `json:"type" default:"code_execution_result"`
  2876  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  2877  	JSON struct {
  2878  		Content     respjson.Field
  2879  		ReturnCode  respjson.Field
  2880  		Stderr      respjson.Field
  2881  		Stdout      respjson.Field
  2882  		Type        respjson.Field
  2883  		ExtraFields map[string]respjson.Field
  2884  		raw         string
  2885  	} `json:"-"`
  2886  }
  2887  
  2888  // Returns the unmodified JSON received from the API
  2889  func (r BetaCodeExecutionResultBlock) RawJSON() string { return r.JSON.raw }
  2890  func (r *BetaCodeExecutionResultBlock) UnmarshalJSON(data []byte) error {
  2891  	return apijson.UnmarshalRoot(data, r)
  2892  }
  2893  
  2894  // The properties Content, ReturnCode, Stderr, Stdout, Type are required.
  2895  type BetaCodeExecutionResultBlockParam struct {
  2896  	Content    []BetaCodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
  2897  	ReturnCode int64                               `json:"return_code" api:"required"`
  2898  	Stderr     string                              `json:"stderr" api:"required"`
  2899  	Stdout     string                              `json:"stdout" api:"required"`
  2900  	// This field can be elided, and will marshal its zero value as
  2901  	// "code_execution_result".
  2902  	Type constant.CodeExecutionResult `json:"type" default:"code_execution_result"`
  2903  	paramObj
  2904  }
  2905  
  2906  func (r BetaCodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error) {
  2907  	type shadow BetaCodeExecutionResultBlockParam
  2908  	return param.MarshalObject(r, (*shadow)(&r))
  2909  }
  2910  func (r *BetaCodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error {
  2911  	return apijson.UnmarshalRoot(data, r)
  2912  }
  2913  
  2914  // The properties Name, Type are required.
  2915  type BetaCodeExecutionTool20250522Param struct {
  2916  	// If true, tool will not be included in initial system prompt. Only loaded when
  2917  	// returned via tool_reference from tool search.
  2918  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  2919  	// When true, guarantees schema validation on tool names and inputs
  2920  	Strict param.Opt[bool] `json:"strict,omitzero"`
  2921  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
  2922  	// "code_execution_20260521".
  2923  	AllowedCallers []string `json:"allowed_callers,omitzero"`
  2924  	// Create a cache control breakpoint at this content block.
  2925  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  2926  	// Name of the tool.
  2927  	//
  2928  	// This is how the tool will be called by the model and in `tool_use` blocks.
  2929  	//
  2930  	// This field can be elided, and will marshal its zero value as "code_execution".
  2931  	Name constant.CodeExecution `json:"name" default:"code_execution"`
  2932  	// This field can be elided, and will marshal its zero value as
  2933  	// "code_execution_20250522".
  2934  	Type constant.CodeExecution20250522 `json:"type" default:"code_execution_20250522"`
  2935  	paramObj
  2936  }
  2937  
  2938  func (r BetaCodeExecutionTool20250522Param) MarshalJSON() (data []byte, err error) {
  2939  	type shadow BetaCodeExecutionTool20250522Param
  2940  	return param.MarshalObject(r, (*shadow)(&r))
  2941  }
  2942  func (r *BetaCodeExecutionTool20250522Param) UnmarshalJSON(data []byte) error {
  2943  	return apijson.UnmarshalRoot(data, r)
  2944  }
  2945  
  2946  // The properties Name, Type are required.
  2947  type BetaCodeExecutionTool20250825Param struct {
  2948  	// If true, tool will not be included in initial system prompt. Only loaded when
  2949  	// returned via tool_reference from tool search.
  2950  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  2951  	// When true, guarantees schema validation on tool names and inputs
  2952  	Strict param.Opt[bool] `json:"strict,omitzero"`
  2953  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
  2954  	// "code_execution_20260521".
  2955  	AllowedCallers []string `json:"allowed_callers,omitzero"`
  2956  	// Create a cache control breakpoint at this content block.
  2957  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  2958  	// Name of the tool.
  2959  	//
  2960  	// This is how the tool will be called by the model and in `tool_use` blocks.
  2961  	//
  2962  	// This field can be elided, and will marshal its zero value as "code_execution".
  2963  	Name constant.CodeExecution `json:"name" default:"code_execution"`
  2964  	// This field can be elided, and will marshal its zero value as
  2965  	// "code_execution_20250825".
  2966  	Type constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
  2967  	paramObj
  2968  }
  2969  
  2970  func (r BetaCodeExecutionTool20250825Param) MarshalJSON() (data []byte, err error) {
  2971  	type shadow BetaCodeExecutionTool20250825Param
  2972  	return param.MarshalObject(r, (*shadow)(&r))
  2973  }
  2974  func (r *BetaCodeExecutionTool20250825Param) UnmarshalJSON(data []byte) error {
  2975  	return apijson.UnmarshalRoot(data, r)
  2976  }
  2977  
  2978  // Code execution tool with REPL state persistence (daemon mode + gVisor
  2979  // checkpoint).
  2980  //
  2981  // The properties Name, Type are required.
  2982  type BetaCodeExecutionTool20260120Param struct {
  2983  	// If true, tool will not be included in initial system prompt. Only loaded when
  2984  	// returned via tool_reference from tool search.
  2985  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  2986  	// When true, guarantees schema validation on tool names and inputs
  2987  	Strict param.Opt[bool] `json:"strict,omitzero"`
  2988  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
  2989  	// "code_execution_20260521".
  2990  	AllowedCallers []string `json:"allowed_callers,omitzero"`
  2991  	// Create a cache control breakpoint at this content block.
  2992  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  2993  	// Name of the tool.
  2994  	//
  2995  	// This is how the tool will be called by the model and in `tool_use` blocks.
  2996  	//
  2997  	// This field can be elided, and will marshal its zero value as "code_execution".
  2998  	Name constant.CodeExecution `json:"name" default:"code_execution"`
  2999  	// This field can be elided, and will marshal its zero value as
  3000  	// "code_execution_20260120".
  3001  	Type constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
  3002  	paramObj
  3003  }
  3004  
  3005  func (r BetaCodeExecutionTool20260120Param) MarshalJSON() (data []byte, err error) {
  3006  	type shadow BetaCodeExecutionTool20260120Param
  3007  	return param.MarshalObject(r, (*shadow)(&r))
  3008  }
  3009  func (r *BetaCodeExecutionTool20260120Param) UnmarshalJSON(data []byte) error {
  3010  	return apijson.UnmarshalRoot(data, r)
  3011  }
  3012  
  3013  // Code execution tool with REPL state persistence.
  3014  //
  3015  // The properties Name, Type are required.
  3016  type BetaCodeExecutionTool20260521Param struct {
  3017  	// If true, tool will not be included in initial system prompt. Only loaded when
  3018  	// returned via tool_reference from tool search.
  3019  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3020  	// When true, guarantees schema validation on tool names and inputs
  3021  	Strict param.Opt[bool] `json:"strict,omitzero"`
  3022  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
  3023  	// "code_execution_20260521".
  3024  	AllowedCallers []string `json:"allowed_callers,omitzero"`
  3025  	// Create a cache control breakpoint at this content block.
  3026  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  3027  	// Name of the tool.
  3028  	//
  3029  	// This is how the tool will be called by the model and in `tool_use` blocks.
  3030  	//
  3031  	// This field can be elided, and will marshal its zero value as "code_execution".
  3032  	Name constant.CodeExecution `json:"name" default:"code_execution"`
  3033  	// This field can be elided, and will marshal its zero value as
  3034  	// "code_execution_20260521".
  3035  	Type constant.CodeExecution20260521 `json:"type" default:"code_execution_20260521"`
  3036  	paramObj
  3037  }
  3038  
  3039  func (r BetaCodeExecutionTool20260521Param) MarshalJSON() (data []byte, err error) {
  3040  	type shadow BetaCodeExecutionTool20260521Param
  3041  	return param.MarshalObject(r, (*shadow)(&r))
  3042  }
  3043  func (r *BetaCodeExecutionTool20260521Param) UnmarshalJSON(data []byte) error {
  3044  	return apijson.UnmarshalRoot(data, r)
  3045  }
  3046  
  3047  type BetaCodeExecutionToolResultBlock struct {
  3048  	// Code execution result with encrypted stdout for PFC + web_search results.
  3049  	Content   BetaCodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
  3050  	ToolUseID string                                       `json:"tool_use_id" api:"required"`
  3051  	Type      constant.CodeExecutionToolResult             `json:"type" default:"code_execution_tool_result"`
  3052  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  3053  	JSON struct {
  3054  		Content     respjson.Field
  3055  		ToolUseID   respjson.Field
  3056  		Type        respjson.Field
  3057  		ExtraFields map[string]respjson.Field
  3058  		raw         string
  3059  	} `json:"-"`
  3060  }
  3061  
  3062  // Returns the unmodified JSON received from the API
  3063  func (r BetaCodeExecutionToolResultBlock) RawJSON() string { return r.JSON.raw }
  3064  func (r *BetaCodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error {
  3065  	return apijson.UnmarshalRoot(data, r)
  3066  }
  3067  
  3068  // BetaCodeExecutionToolResultBlockContentUnion contains all possible properties
  3069  // and values from [BetaCodeExecutionToolResultError],
  3070  // [BetaCodeExecutionResultBlock], [BetaEncryptedCodeExecutionResultBlock].
  3071  //
  3072  // Use the methods beginning with 'As' to cast the union to one of its variants.
  3073  type BetaCodeExecutionToolResultBlockContentUnion struct {
  3074  	// This field is from variant [BetaCodeExecutionToolResultError].
  3075  	ErrorCode  BetaCodeExecutionToolResultErrorCode `json:"error_code"`
  3076  	Type       string                               `json:"type"`
  3077  	Content    []BetaCodeExecutionOutputBlock       `json:"content"`
  3078  	ReturnCode int64                                `json:"return_code"`
  3079  	Stderr     string                               `json:"stderr"`
  3080  	// This field is from variant [BetaCodeExecutionResultBlock].
  3081  	Stdout string `json:"stdout"`
  3082  	// This field is from variant [BetaEncryptedCodeExecutionResultBlock].
  3083  	EncryptedStdout string `json:"encrypted_stdout"`
  3084  	JSON            struct {
  3085  		ErrorCode       respjson.Field
  3086  		Type            respjson.Field
  3087  		Content         respjson.Field
  3088  		ReturnCode      respjson.Field
  3089  		Stderr          respjson.Field
  3090  		Stdout          respjson.Field
  3091  		EncryptedStdout respjson.Field
  3092  		raw             string
  3093  	} `json:"-"`
  3094  }
  3095  
  3096  func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionToolResultError() (v BetaCodeExecutionToolResultError) {
  3097  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  3098  	return
  3099  }
  3100  
  3101  func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionResultBlock() (v BetaCodeExecutionResultBlock) {
  3102  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  3103  	return
  3104  }
  3105  
  3106  func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseEncryptedCodeExecutionResultBlock() (v BetaEncryptedCodeExecutionResultBlock) {
  3107  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  3108  	return
  3109  }
  3110  
  3111  // Returns the unmodified JSON received from the API
  3112  func (u BetaCodeExecutionToolResultBlockContentUnion) RawJSON() string { return u.JSON.raw }
  3113  
  3114  func (r *BetaCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error {
  3115  	return apijson.UnmarshalRoot(data, r)
  3116  }
  3117  
  3118  // The properties Content, ToolUseID, Type are required.
  3119  type BetaCodeExecutionToolResultBlockParam struct {
  3120  	// Code execution result with encrypted stdout for PFC + web_search results.
  3121  	Content   BetaCodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
  3122  	ToolUseID string                                            `json:"tool_use_id" api:"required"`
  3123  	// Create a cache control breakpoint at this content block.
  3124  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  3125  	// This field can be elided, and will marshal its zero value as
  3126  	// "code_execution_tool_result".
  3127  	Type constant.CodeExecutionToolResult `json:"type" default:"code_execution_tool_result"`
  3128  	paramObj
  3129  }
  3130  
  3131  func (r BetaCodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error) {
  3132  	type shadow BetaCodeExecutionToolResultBlockParam
  3133  	return param.MarshalObject(r, (*shadow)(&r))
  3134  }
  3135  func (r *BetaCodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error {
  3136  	return apijson.UnmarshalRoot(data, r)
  3137  }
  3138  
  3139  func BetaNewCodeExecutionToolRequestError(errorCode BetaCodeExecutionToolResultErrorCode) BetaCodeExecutionToolResultBlockParamContentUnion {
  3140  	var variant BetaCodeExecutionToolResultErrorParam
  3141  	variant.ErrorCode = errorCode
  3142  	return BetaCodeExecutionToolResultBlockParamContentUnion{OfError: &variant}
  3143  }
  3144  
  3145  // Only one field can be non-zero.
  3146  //
  3147  // Use [param.IsOmitted] to confirm if a field is set.
  3148  type BetaCodeExecutionToolResultBlockParamContentUnion struct {
  3149  	OfError                                    *BetaCodeExecutionToolResultErrorParam      `json:",omitzero,inline"`
  3150  	OfResultBlock                              *BetaCodeExecutionResultBlockParam          `json:",omitzero,inline"`
  3151  	OfRequestEncryptedCodeExecutionResultBlock *BetaEncryptedCodeExecutionResultBlockParam `json:",omitzero,inline"`
  3152  	paramUnion
  3153  }
  3154  
  3155  func (u BetaCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
  3156  	return param.MarshalUnion(u, u.OfError, u.OfResultBlock, u.OfRequestEncryptedCodeExecutionResultBlock)
  3157  }
  3158  func (u *BetaCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
  3159  	return apijson.UnmarshalRoot(data, u)
  3160  }
  3161  
  3162  func (u *BetaCodeExecutionToolResultBlockParamContentUnion) asAny() any {
  3163  	if !param.IsOmitted(u.OfError) {
  3164  		return u.OfError
  3165  	} else if !param.IsOmitted(u.OfResultBlock) {
  3166  		return u.OfResultBlock
  3167  	} else if !param.IsOmitted(u.OfRequestEncryptedCodeExecutionResultBlock) {
  3168  		return u.OfRequestEncryptedCodeExecutionResultBlock
  3169  	}
  3170  	return nil
  3171  }
  3172  
  3173  // Returns a pointer to the underlying variant's property, if present.
  3174  func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string {
  3175  	if vt := u.OfError; vt != nil {
  3176  		return (*string)(&vt.ErrorCode)
  3177  	}
  3178  	return nil
  3179  }
  3180  
  3181  // Returns a pointer to the underlying variant's property, if present.
  3182  func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetStdout() *string {
  3183  	if vt := u.OfResultBlock; vt != nil {
  3184  		return &vt.Stdout
  3185  	}
  3186  	return nil
  3187  }
  3188  
  3189  // Returns a pointer to the underlying variant's property, if present.
  3190  func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetEncryptedStdout() *string {
  3191  	if vt := u.OfRequestEncryptedCodeExecutionResultBlock; vt != nil {
  3192  		return &vt.EncryptedStdout
  3193  	}
  3194  	return nil
  3195  }
  3196  
  3197  // Returns a pointer to the underlying variant's property, if present.
  3198  func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetType() *string {
  3199  	if vt := u.OfError; vt != nil {
  3200  		return (*string)(&vt.Type)
  3201  	} else if vt := u.OfResultBlock; vt != nil {
  3202  		return (*string)(&vt.Type)
  3203  	} else if vt := u.OfRequestEncryptedCodeExecutionResultBlock; vt != nil {
  3204  		return (*string)(&vt.Type)
  3205  	}
  3206  	return nil
  3207  }
  3208  
  3209  // Returns a pointer to the underlying variant's property, if present.
  3210  func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64 {
  3211  	if vt := u.OfResultBlock; vt != nil {
  3212  		return (*int64)(&vt.ReturnCode)
  3213  	} else if vt := u.OfRequestEncryptedCodeExecutionResultBlock; vt != nil {
  3214  		return (*int64)(&vt.ReturnCode)
  3215  	}
  3216  	return nil
  3217  }
  3218  
  3219  // Returns a pointer to the underlying variant's property, if present.
  3220  func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetStderr() *string {
  3221  	if vt := u.OfResultBlock; vt != nil {
  3222  		return (*string)(&vt.Stderr)
  3223  	} else if vt := u.OfRequestEncryptedCodeExecutionResultBlock; vt != nil {
  3224  		return (*string)(&vt.Stderr)
  3225  	}
  3226  	return nil
  3227  }
  3228  
  3229  // Returns a pointer to the underlying variant's Content property, if present.
  3230  func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetContent() []BetaCodeExecutionOutputBlockParam {
  3231  	if vt := u.OfResultBlock; vt != nil {
  3232  		return vt.Content
  3233  	} else if vt := u.OfRequestEncryptedCodeExecutionResultBlock; vt != nil {
  3234  		return vt.Content
  3235  	}
  3236  	return nil
  3237  }
  3238  
  3239  type BetaCodeExecutionToolResultError struct {
  3240  	// Any of "invalid_tool_input", "unavailable", "too_many_requests",
  3241  	// "execution_time_exceeded".
  3242  	ErrorCode BetaCodeExecutionToolResultErrorCode  `json:"error_code" api:"required"`
  3243  	Type      constant.CodeExecutionToolResultError `json:"type" default:"code_execution_tool_result_error"`
  3244  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  3245  	JSON struct {
  3246  		ErrorCode   respjson.Field
  3247  		Type        respjson.Field
  3248  		ExtraFields map[string]respjson.Field
  3249  		raw         string
  3250  	} `json:"-"`
  3251  }
  3252  
  3253  // Returns the unmodified JSON received from the API
  3254  func (r BetaCodeExecutionToolResultError) RawJSON() string { return r.JSON.raw }
  3255  func (r *BetaCodeExecutionToolResultError) UnmarshalJSON(data []byte) error {
  3256  	return apijson.UnmarshalRoot(data, r)
  3257  }
  3258  
  3259  type BetaCodeExecutionToolResultErrorCode string
  3260  
  3261  const (
  3262  	BetaCodeExecutionToolResultErrorCodeInvalidToolInput      BetaCodeExecutionToolResultErrorCode = "invalid_tool_input"
  3263  	BetaCodeExecutionToolResultErrorCodeUnavailable           BetaCodeExecutionToolResultErrorCode = "unavailable"
  3264  	BetaCodeExecutionToolResultErrorCodeTooManyRequests       BetaCodeExecutionToolResultErrorCode = "too_many_requests"
  3265  	BetaCodeExecutionToolResultErrorCodeExecutionTimeExceeded BetaCodeExecutionToolResultErrorCode = "execution_time_exceeded"
  3266  )
  3267  
  3268  // The properties ErrorCode, Type are required.
  3269  type BetaCodeExecutionToolResultErrorParam struct {
  3270  	// Any of "invalid_tool_input", "unavailable", "too_many_requests",
  3271  	// "execution_time_exceeded".
  3272  	ErrorCode BetaCodeExecutionToolResultErrorCode `json:"error_code,omitzero" api:"required"`
  3273  	// This field can be elided, and will marshal its zero value as
  3274  	// "code_execution_tool_result_error".
  3275  	Type constant.CodeExecutionToolResultError `json:"type" default:"code_execution_tool_result_error"`
  3276  	paramObj
  3277  }
  3278  
  3279  func (r BetaCodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error) {
  3280  	type shadow BetaCodeExecutionToolResultErrorParam
  3281  	return param.MarshalObject(r, (*shadow)(&r))
  3282  }
  3283  func (r *BetaCodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error {
  3284  	return apijson.UnmarshalRoot(data, r)
  3285  }
  3286  
  3287  // Automatically compact older context when reaching the configured trigger
  3288  // threshold.
  3289  //
  3290  // The property Type is required.
  3291  type BetaCompact20260112EditParam struct {
  3292  	// Additional instructions for summarization.
  3293  	Instructions param.Opt[string] `json:"instructions,omitzero"`
  3294  	// Whether to pause after compaction and return the compaction block to the user.
  3295  	PauseAfterCompaction param.Opt[bool] `json:"pause_after_compaction,omitzero"`
  3296  	// When to trigger compaction. Defaults to 150000 input tokens.
  3297  	Trigger BetaInputTokensTriggerParam `json:"trigger,omitzero"`
  3298  	// This field can be elided, and will marshal its zero value as "compact_20260112".
  3299  	Type constant.Compact20260112 `json:"type" default:"compact_20260112"`
  3300  	paramObj
  3301  }
  3302  
  3303  func (r BetaCompact20260112EditParam) MarshalJSON() (data []byte, err error) {
  3304  	type shadow BetaCompact20260112EditParam
  3305  	return param.MarshalObject(r, (*shadow)(&r))
  3306  }
  3307  func (r *BetaCompact20260112EditParam) UnmarshalJSON(data []byte) error {
  3308  	return apijson.UnmarshalRoot(data, r)
  3309  }
  3310  
  3311  // A compaction block returned when autocompact is triggered.
  3312  //
  3313  // When content is None, it indicates the compaction failed to produce a valid
  3314  // summary (e.g., malformed output from the model). Clients may round-trip
  3315  // compaction blocks with null content; the server treats them as no-ops.
  3316  type BetaCompactionBlock struct {
  3317  	// Summary of compacted content, or null if compaction failed
  3318  	Content string `json:"content" api:"required"`
  3319  	// Opaque metadata from prior compaction, to be round-tripped verbatim
  3320  	EncryptedContent string              `json:"encrypted_content" api:"required"`
  3321  	Type             constant.Compaction `json:"type" default:"compaction"`
  3322  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  3323  	JSON struct {
  3324  		Content          respjson.Field
  3325  		EncryptedContent respjson.Field
  3326  		Type             respjson.Field
  3327  		ExtraFields      map[string]respjson.Field
  3328  		raw              string
  3329  	} `json:"-"`
  3330  }
  3331  
  3332  // Returns the unmodified JSON received from the API
  3333  func (r BetaCompactionBlock) RawJSON() string { return r.JSON.raw }
  3334  func (r *BetaCompactionBlock) UnmarshalJSON(data []byte) error {
  3335  	return apijson.UnmarshalRoot(data, r)
  3336  }
  3337  
  3338  // A compaction block containing summary of previous context.
  3339  //
  3340  // Users should round-trip these blocks from responses to subsequent requests to
  3341  // maintain context across compaction boundaries.
  3342  //
  3343  // When content is None, the block represents a failed compaction. The server
  3344  // treats these as no-ops. Empty string content is not allowed.
  3345  //
  3346  // The property Type is required.
  3347  type BetaCompactionBlockParam struct {
  3348  	// Summary of previously compacted content, or null if compaction failed
  3349  	Content param.Opt[string] `json:"content,omitzero"`
  3350  	// Opaque metadata from prior compaction, to be round-tripped verbatim
  3351  	EncryptedContent param.Opt[string] `json:"encrypted_content,omitzero"`
  3352  	// Create a cache control breakpoint at this content block.
  3353  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  3354  	// This field can be elided, and will marshal its zero value as "compaction".
  3355  	Type constant.Compaction `json:"type" default:"compaction"`
  3356  	paramObj
  3357  }
  3358  
  3359  func (r BetaCompactionBlockParam) MarshalJSON() (data []byte, err error) {
  3360  	type shadow BetaCompactionBlockParam
  3361  	return param.MarshalObject(r, (*shadow)(&r))
  3362  }
  3363  func (r *BetaCompactionBlockParam) UnmarshalJSON(data []byte) error {
  3364  	return apijson.UnmarshalRoot(data, r)
  3365  }
  3366  
  3367  type BetaCompactionContentBlockDelta struct {
  3368  	Content string `json:"content" api:"required"`
  3369  	// Opaque metadata from prior compaction, to be round-tripped verbatim
  3370  	EncryptedContent string                   `json:"encrypted_content" api:"required"`
  3371  	Type             constant.CompactionDelta `json:"type" default:"compaction_delta"`
  3372  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  3373  	JSON struct {
  3374  		Content          respjson.Field
  3375  		EncryptedContent respjson.Field
  3376  		Type             respjson.Field
  3377  		ExtraFields      map[string]respjson.Field
  3378  		raw              string
  3379  	} `json:"-"`
  3380  }
  3381  
  3382  // Returns the unmodified JSON received from the API
  3383  func (r BetaCompactionContentBlockDelta) RawJSON() string { return r.JSON.raw }
  3384  func (r *BetaCompactionContentBlockDelta) UnmarshalJSON(data []byte) error {
  3385  	return apijson.UnmarshalRoot(data, r)
  3386  }
  3387  
  3388  // Token usage for a compaction iteration.
  3389  type BetaCompactionIterationUsage struct {
  3390  	// Breakdown of cached tokens by TTL
  3391  	CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
  3392  	// The number of input tokens used to create the cache entry.
  3393  	CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
  3394  	// The number of input tokens read from the cache.
  3395  	CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
  3396  	// The number of input tokens which were used.
  3397  	InputTokens int64 `json:"input_tokens" api:"required"`
  3398  	// The number of output tokens which were used.
  3399  	OutputTokens int64 `json:"output_tokens" api:"required"`
  3400  	// Usage for a compaction iteration
  3401  	Type constant.Compaction `json:"type" default:"compaction"`
  3402  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  3403  	JSON struct {
  3404  		CacheCreation            respjson.Field
  3405  		CacheCreationInputTokens respjson.Field
  3406  		CacheReadInputTokens     respjson.Field
  3407  		InputTokens              respjson.Field
  3408  		OutputTokens             respjson.Field
  3409  		Type                     respjson.Field
  3410  		ExtraFields              map[string]respjson.Field
  3411  		raw                      string
  3412  	} `json:"-"`
  3413  }
  3414  
  3415  // Returns the unmodified JSON received from the API
  3416  func (r BetaCompactionIterationUsage) RawJSON() string { return r.JSON.raw }
  3417  func (r *BetaCompactionIterationUsage) UnmarshalJSON(data []byte) error {
  3418  	return apijson.UnmarshalRoot(data, r)
  3419  }
  3420  
  3421  // `cursor_position`'s config overrides.
  3422  type BetaComputerCursorPositionConfigParam struct {
  3423  	// Defer loading for this member. Must resolve to the same value on every enabled
  3424  	// member of the toolset.
  3425  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3426  	// Whether this member is offered to the model. Default is per member, per the
  3427  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3428  	// the served schema.
  3429  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3430  	paramObj
  3431  }
  3432  
  3433  func (r BetaComputerCursorPositionConfigParam) MarshalJSON() (data []byte, err error) {
  3434  	type shadow BetaComputerCursorPositionConfigParam
  3435  	return param.MarshalObject(r, (*shadow)(&r))
  3436  }
  3437  func (r *BetaComputerCursorPositionConfigParam) UnmarshalJSON(data []byte) error {
  3438  	return apijson.UnmarshalRoot(data, r)
  3439  }
  3440  
  3441  // `double_click`'s config overrides.
  3442  type BetaComputerDoubleClickConfigParam struct {
  3443  	// Defer loading for this member. Must resolve to the same value on every enabled
  3444  	// member of the toolset.
  3445  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3446  	// Whether this member is offered to the model. Default is per member, per the
  3447  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3448  	// the served schema.
  3449  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3450  	paramObj
  3451  }
  3452  
  3453  func (r BetaComputerDoubleClickConfigParam) MarshalJSON() (data []byte, err error) {
  3454  	type shadow BetaComputerDoubleClickConfigParam
  3455  	return param.MarshalObject(r, (*shadow)(&r))
  3456  }
  3457  func (r *BetaComputerDoubleClickConfigParam) UnmarshalJSON(data []byte) error {
  3458  	return apijson.UnmarshalRoot(data, r)
  3459  }
  3460  
  3461  // `hold_key`'s config overrides.
  3462  type BetaComputerHoldKeyConfigParam struct {
  3463  	// Defer loading for this member. Must resolve to the same value on every enabled
  3464  	// member of the toolset.
  3465  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3466  	// Whether this member is offered to the model. Default is per member, per the
  3467  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3468  	// the served schema.
  3469  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3470  	paramObj
  3471  }
  3472  
  3473  func (r BetaComputerHoldKeyConfigParam) MarshalJSON() (data []byte, err error) {
  3474  	type shadow BetaComputerHoldKeyConfigParam
  3475  	return param.MarshalObject(r, (*shadow)(&r))
  3476  }
  3477  func (r *BetaComputerHoldKeyConfigParam) UnmarshalJSON(data []byte) error {
  3478  	return apijson.UnmarshalRoot(data, r)
  3479  }
  3480  
  3481  // `key`'s config overrides.
  3482  type BetaComputerKeyConfigParam struct {
  3483  	// Defer loading for this member. Must resolve to the same value on every enabled
  3484  	// member of the toolset.
  3485  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3486  	// Whether this member is offered to the model. Default is per member, per the
  3487  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3488  	// the served schema.
  3489  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3490  	paramObj
  3491  }
  3492  
  3493  func (r BetaComputerKeyConfigParam) MarshalJSON() (data []byte, err error) {
  3494  	type shadow BetaComputerKeyConfigParam
  3495  	return param.MarshalObject(r, (*shadow)(&r))
  3496  }
  3497  func (r *BetaComputerKeyConfigParam) UnmarshalJSON(data []byte) error {
  3498  	return apijson.UnmarshalRoot(data, r)
  3499  }
  3500  
  3501  // `left_click`'s config overrides.
  3502  type BetaComputerLeftClickConfigParam struct {
  3503  	// Defer loading for this member. Must resolve to the same value on every enabled
  3504  	// member of the toolset.
  3505  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3506  	// Whether this member is offered to the model. Default is per member, per the
  3507  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3508  	// the served schema.
  3509  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3510  	paramObj
  3511  }
  3512  
  3513  func (r BetaComputerLeftClickConfigParam) MarshalJSON() (data []byte, err error) {
  3514  	type shadow BetaComputerLeftClickConfigParam
  3515  	return param.MarshalObject(r, (*shadow)(&r))
  3516  }
  3517  func (r *BetaComputerLeftClickConfigParam) UnmarshalJSON(data []byte) error {
  3518  	return apijson.UnmarshalRoot(data, r)
  3519  }
  3520  
  3521  // `left_click_drag`'s config overrides.
  3522  type BetaComputerLeftClickDragConfigParam struct {
  3523  	// Defer loading for this member. Must resolve to the same value on every enabled
  3524  	// member of the toolset.
  3525  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3526  	// Whether this member is offered to the model. Default is per member, per the
  3527  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3528  	// the served schema.
  3529  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3530  	paramObj
  3531  }
  3532  
  3533  func (r BetaComputerLeftClickDragConfigParam) MarshalJSON() (data []byte, err error) {
  3534  	type shadow BetaComputerLeftClickDragConfigParam
  3535  	return param.MarshalObject(r, (*shadow)(&r))
  3536  }
  3537  func (r *BetaComputerLeftClickDragConfigParam) UnmarshalJSON(data []byte) error {
  3538  	return apijson.UnmarshalRoot(data, r)
  3539  }
  3540  
  3541  // `left_mouse_down`'s config overrides.
  3542  type BetaComputerLeftMouseDownConfigParam struct {
  3543  	// Defer loading for this member. Must resolve to the same value on every enabled
  3544  	// member of the toolset.
  3545  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3546  	// Whether this member is offered to the model. Default is per member, per the
  3547  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3548  	// the served schema.
  3549  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3550  	paramObj
  3551  }
  3552  
  3553  func (r BetaComputerLeftMouseDownConfigParam) MarshalJSON() (data []byte, err error) {
  3554  	type shadow BetaComputerLeftMouseDownConfigParam
  3555  	return param.MarshalObject(r, (*shadow)(&r))
  3556  }
  3557  func (r *BetaComputerLeftMouseDownConfigParam) UnmarshalJSON(data []byte) error {
  3558  	return apijson.UnmarshalRoot(data, r)
  3559  }
  3560  
  3561  // `left_mouse_up`'s config overrides.
  3562  type BetaComputerLeftMouseUpConfigParam struct {
  3563  	// Defer loading for this member. Must resolve to the same value on every enabled
  3564  	// member of the toolset.
  3565  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3566  	// Whether this member is offered to the model. Default is per member, per the
  3567  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3568  	// the served schema.
  3569  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3570  	paramObj
  3571  }
  3572  
  3573  func (r BetaComputerLeftMouseUpConfigParam) MarshalJSON() (data []byte, err error) {
  3574  	type shadow BetaComputerLeftMouseUpConfigParam
  3575  	return param.MarshalObject(r, (*shadow)(&r))
  3576  }
  3577  func (r *BetaComputerLeftMouseUpConfigParam) UnmarshalJSON(data []byte) error {
  3578  	return apijson.UnmarshalRoot(data, r)
  3579  }
  3580  
  3581  // `middle_click`'s config overrides.
  3582  type BetaComputerMiddleClickConfigParam struct {
  3583  	// Defer loading for this member. Must resolve to the same value on every enabled
  3584  	// member of the toolset.
  3585  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3586  	// Whether this member is offered to the model. Default is per member, per the
  3587  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3588  	// the served schema.
  3589  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3590  	paramObj
  3591  }
  3592  
  3593  func (r BetaComputerMiddleClickConfigParam) MarshalJSON() (data []byte, err error) {
  3594  	type shadow BetaComputerMiddleClickConfigParam
  3595  	return param.MarshalObject(r, (*shadow)(&r))
  3596  }
  3597  func (r *BetaComputerMiddleClickConfigParam) UnmarshalJSON(data []byte) error {
  3598  	return apijson.UnmarshalRoot(data, r)
  3599  }
  3600  
  3601  // `mouse_move`'s config overrides.
  3602  type BetaComputerMouseMoveConfigParam struct {
  3603  	// Defer loading for this member. Must resolve to the same value on every enabled
  3604  	// member of the toolset.
  3605  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3606  	// Whether this member is offered to the model. Default is per member, per the
  3607  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3608  	// the served schema.
  3609  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3610  	paramObj
  3611  }
  3612  
  3613  func (r BetaComputerMouseMoveConfigParam) MarshalJSON() (data []byte, err error) {
  3614  	type shadow BetaComputerMouseMoveConfigParam
  3615  	return param.MarshalObject(r, (*shadow)(&r))
  3616  }
  3617  func (r *BetaComputerMouseMoveConfigParam) UnmarshalJSON(data []byte) error {
  3618  	return apijson.UnmarshalRoot(data, r)
  3619  }
  3620  
  3621  // `right_click`'s config overrides.
  3622  type BetaComputerRightClickConfigParam struct {
  3623  	// Defer loading for this member. Must resolve to the same value on every enabled
  3624  	// member of the toolset.
  3625  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3626  	// Whether this member is offered to the model. Default is per member, per the
  3627  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3628  	// the served schema.
  3629  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3630  	paramObj
  3631  }
  3632  
  3633  func (r BetaComputerRightClickConfigParam) MarshalJSON() (data []byte, err error) {
  3634  	type shadow BetaComputerRightClickConfigParam
  3635  	return param.MarshalObject(r, (*shadow)(&r))
  3636  }
  3637  func (r *BetaComputerRightClickConfigParam) UnmarshalJSON(data []byte) error {
  3638  	return apijson.UnmarshalRoot(data, r)
  3639  }
  3640  
  3641  // `screenshot`'s config overrides.
  3642  type BetaComputerScreenshotConfigParam struct {
  3643  	// Defer loading for this member. Must resolve to the same value on every enabled
  3644  	// member of the toolset.
  3645  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3646  	// Whether this member is offered to the model. Default is per member, per the
  3647  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3648  	// the served schema.
  3649  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3650  	paramObj
  3651  }
  3652  
  3653  func (r BetaComputerScreenshotConfigParam) MarshalJSON() (data []byte, err error) {
  3654  	type shadow BetaComputerScreenshotConfigParam
  3655  	return param.MarshalObject(r, (*shadow)(&r))
  3656  }
  3657  func (r *BetaComputerScreenshotConfigParam) UnmarshalJSON(data []byte) error {
  3658  	return apijson.UnmarshalRoot(data, r)
  3659  }
  3660  
  3661  // `scroll`'s config overrides.
  3662  type BetaComputerScrollConfigParam struct {
  3663  	// Defer loading for this member. Must resolve to the same value on every enabled
  3664  	// member of the toolset.
  3665  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3666  	// Whether this member is offered to the model. Default is per member, per the
  3667  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3668  	// the served schema.
  3669  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3670  	paramObj
  3671  }
  3672  
  3673  func (r BetaComputerScrollConfigParam) MarshalJSON() (data []byte, err error) {
  3674  	type shadow BetaComputerScrollConfigParam
  3675  	return param.MarshalObject(r, (*shadow)(&r))
  3676  }
  3677  func (r *BetaComputerScrollConfigParam) UnmarshalJSON(data []byte) error {
  3678  	return apijson.UnmarshalRoot(data, r)
  3679  }
  3680  
  3681  // The computer toolset: a single `tools[]` entry (carrying no `name`) that
  3682  // declares the computer tool family. The model is served the family's tool with
  3683  // any members disabled via `configs` removed from its schema. Every member is
  3684  // enabled by default, zoom included. The single-tool options `display_number` and
  3685  // `enable_zoom` are not fields of a toolset entry — it carries only `type`,
  3686  // `configs`, and `cache_control`; zoom is controlled via `configs.zoom.enabled`.
  3687  //
  3688  // The property Type is required.
  3689  type BetaComputerToolset20260801Param struct {
  3690  	// Create a cache control breakpoint at this content block.
  3691  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  3692  	// Per-member configuration for `computer_toolset_20260801`: one optional field per
  3693  	// member tool, keyed by the member name — the same name the member's `tool_use`
  3694  	// blocks carry. Every member is an accepted key, and a member's defaults apply
  3695  	// wherever its key is absent. Unknown keys are rejected: the field set is this
  3696  	// toolset version's complete member set.
  3697  	Configs BetaComputerToolsetConfigsParam `json:"configs,omitzero"`
  3698  	// This field can be elided, and will marshal its zero value as
  3699  	// "computer_toolset_20260801".
  3700  	Type constant.ComputerToolset20260801 `json:"type" default:"computer_toolset_20260801"`
  3701  	paramObj
  3702  }
  3703  
  3704  func (r BetaComputerToolset20260801Param) MarshalJSON() (data []byte, err error) {
  3705  	type shadow BetaComputerToolset20260801Param
  3706  	return param.MarshalObject(r, (*shadow)(&r))
  3707  }
  3708  func (r *BetaComputerToolset20260801Param) UnmarshalJSON(data []byte) error {
  3709  	return apijson.UnmarshalRoot(data, r)
  3710  }
  3711  
  3712  // Per-member configuration for `computer_toolset_20260801`: one optional field per
  3713  // member tool, keyed by the member name — the same name the member's `tool_use`
  3714  // blocks carry. Every member is an accepted key, and a member's defaults apply
  3715  // wherever its key is absent. Unknown keys are rejected: the field set is this
  3716  // toolset version's complete member set.
  3717  type BetaComputerToolsetConfigsParam struct {
  3718  	// `cursor_position`'s config overrides.
  3719  	CursorPosition BetaComputerCursorPositionConfigParam `json:"cursor_position,omitzero"`
  3720  	// `double_click`'s config overrides.
  3721  	DoubleClick BetaComputerDoubleClickConfigParam `json:"double_click,omitzero"`
  3722  	// `hold_key`'s config overrides.
  3723  	HoldKey BetaComputerHoldKeyConfigParam `json:"hold_key,omitzero"`
  3724  	// `key`'s config overrides.
  3725  	Key BetaComputerKeyConfigParam `json:"key,omitzero"`
  3726  	// `left_click`'s config overrides.
  3727  	LeftClick BetaComputerLeftClickConfigParam `json:"left_click,omitzero"`
  3728  	// `left_click_drag`'s config overrides.
  3729  	LeftClickDrag BetaComputerLeftClickDragConfigParam `json:"left_click_drag,omitzero"`
  3730  	// `left_mouse_down`'s config overrides.
  3731  	LeftMouseDown BetaComputerLeftMouseDownConfigParam `json:"left_mouse_down,omitzero"`
  3732  	// `left_mouse_up`'s config overrides.
  3733  	LeftMouseUp BetaComputerLeftMouseUpConfigParam `json:"left_mouse_up,omitzero"`
  3734  	// `middle_click`'s config overrides.
  3735  	MiddleClick BetaComputerMiddleClickConfigParam `json:"middle_click,omitzero"`
  3736  	// `mouse_move`'s config overrides.
  3737  	MouseMove BetaComputerMouseMoveConfigParam `json:"mouse_move,omitzero"`
  3738  	// `right_click`'s config overrides.
  3739  	RightClick BetaComputerRightClickConfigParam `json:"right_click,omitzero"`
  3740  	// `screenshot`'s config overrides.
  3741  	Screenshot BetaComputerScreenshotConfigParam `json:"screenshot,omitzero"`
  3742  	// `scroll`'s config overrides.
  3743  	Scroll BetaComputerScrollConfigParam `json:"scroll,omitzero"`
  3744  	// `triple_click`'s config overrides.
  3745  	TripleClick BetaComputerTripleClickConfigParam `json:"triple_click,omitzero"`
  3746  	// `type`'s config overrides.
  3747  	Type BetaComputerTypeConfigParam `json:"type,omitzero"`
  3748  	// `wait`'s config overrides.
  3749  	Wait BetaComputerWaitConfigParam `json:"wait,omitzero"`
  3750  	// `zoom`'s config overrides.
  3751  	Zoom BetaComputerZoomConfigParam `json:"zoom,omitzero"`
  3752  	paramObj
  3753  }
  3754  
  3755  func (r BetaComputerToolsetConfigsParam) MarshalJSON() (data []byte, err error) {
  3756  	type shadow BetaComputerToolsetConfigsParam
  3757  	return param.MarshalObject(r, (*shadow)(&r))
  3758  }
  3759  func (r *BetaComputerToolsetConfigsParam) UnmarshalJSON(data []byte) error {
  3760  	return apijson.UnmarshalRoot(data, r)
  3761  }
  3762  
  3763  // `triple_click`'s config overrides.
  3764  type BetaComputerTripleClickConfigParam struct {
  3765  	// Defer loading for this member. Must resolve to the same value on every enabled
  3766  	// member of the toolset.
  3767  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3768  	// Whether this member is offered to the model. Default is per member, per the
  3769  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3770  	// the served schema.
  3771  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3772  	paramObj
  3773  }
  3774  
  3775  func (r BetaComputerTripleClickConfigParam) MarshalJSON() (data []byte, err error) {
  3776  	type shadow BetaComputerTripleClickConfigParam
  3777  	return param.MarshalObject(r, (*shadow)(&r))
  3778  }
  3779  func (r *BetaComputerTripleClickConfigParam) UnmarshalJSON(data []byte) error {
  3780  	return apijson.UnmarshalRoot(data, r)
  3781  }
  3782  
  3783  // `type`'s config overrides.
  3784  type BetaComputerTypeConfigParam struct {
  3785  	// Defer loading for this member. Must resolve to the same value on every enabled
  3786  	// member of the toolset.
  3787  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3788  	// Whether this member is offered to the model. Default is per member, per the
  3789  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3790  	// the served schema.
  3791  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3792  	paramObj
  3793  }
  3794  
  3795  func (r BetaComputerTypeConfigParam) MarshalJSON() (data []byte, err error) {
  3796  	type shadow BetaComputerTypeConfigParam
  3797  	return param.MarshalObject(r, (*shadow)(&r))
  3798  }
  3799  func (r *BetaComputerTypeConfigParam) UnmarshalJSON(data []byte) error {
  3800  	return apijson.UnmarshalRoot(data, r)
  3801  }
  3802  
  3803  // `wait`'s config overrides.
  3804  type BetaComputerWaitConfigParam struct {
  3805  	// Defer loading for this member. Must resolve to the same value on every enabled
  3806  	// member of the toolset.
  3807  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3808  	// Whether this member is offered to the model. Default is per member, per the
  3809  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3810  	// the served schema.
  3811  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3812  	paramObj
  3813  }
  3814  
  3815  func (r BetaComputerWaitConfigParam) MarshalJSON() (data []byte, err error) {
  3816  	type shadow BetaComputerWaitConfigParam
  3817  	return param.MarshalObject(r, (*shadow)(&r))
  3818  }
  3819  func (r *BetaComputerWaitConfigParam) UnmarshalJSON(data []byte) error {
  3820  	return apijson.UnmarshalRoot(data, r)
  3821  }
  3822  
  3823  // `zoom`'s config overrides.
  3824  type BetaComputerZoomConfigParam struct {
  3825  	// Defer loading for this member. Must resolve to the same value on every enabled
  3826  	// member of the toolset.
  3827  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  3828  	// Whether this member is offered to the model. Default is per member, per the
  3829  	// toolset's documentation. A member whose enabled resolves false is withheld from
  3830  	// the served schema.
  3831  	Enabled param.Opt[bool] `json:"enabled,omitzero"`
  3832  	paramObj
  3833  }
  3834  
  3835  func (r BetaComputerZoomConfigParam) MarshalJSON() (data []byte, err error) {
  3836  	type shadow BetaComputerZoomConfigParam
  3837  	return param.MarshalObject(r, (*shadow)(&r))
  3838  }
  3839  func (r *BetaComputerZoomConfigParam) UnmarshalJSON(data []byte) error {
  3840  	return apijson.UnmarshalRoot(data, r)
  3841  }
  3842  
  3843  // Information about the container used in the request (for the code execution
  3844  // tool)
  3845  type BetaContainer struct {
  3846  	// Identifier for the container used in this request
  3847  	ID string `json:"id" api:"required"`
  3848  	// The time at which the container will expire.
  3849  	ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
  3850  	// Skills loaded in the container
  3851  	Skills []BetaContainerSkill `json:"skills" api:"required"`
  3852  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  3853  	JSON struct {
  3854  		ID          respjson.Field
  3855  		ExpiresAt   respjson.Field
  3856  		Skills      respjson.Field
  3857  		ExtraFields map[string]respjson.Field
  3858  		raw         string
  3859  	} `json:"-"`
  3860  }
  3861  
  3862  // Returns the unmodified JSON received from the API
  3863  func (r BetaContainer) RawJSON() string { return r.JSON.raw }
  3864  func (r *BetaContainer) UnmarshalJSON(data []byte) error {
  3865  	return apijson.UnmarshalRoot(data, r)
  3866  }
  3867  
  3868  // Container parameters with skills to be loaded.
  3869  type BetaContainerParams struct {
  3870  	// Container id
  3871  	ID param.Opt[string] `json:"id,omitzero"`
  3872  	// List of skills to load in the container
  3873  	Skills []BetaSkillParams `json:"skills,omitzero"`
  3874  	paramObj
  3875  }
  3876  
  3877  func (r BetaContainerParams) MarshalJSON() (data []byte, err error) {
  3878  	type shadow BetaContainerParams
  3879  	return param.MarshalObject(r, (*shadow)(&r))
  3880  }
  3881  func (r *BetaContainerParams) UnmarshalJSON(data []byte) error {
  3882  	return apijson.UnmarshalRoot(data, r)
  3883  }
  3884  
  3885  // A skill that was loaded in a container (response model).
  3886  type BetaContainerSkill struct {
  3887  	// Skill ID
  3888  	SkillID string `json:"skill_id" api:"required"`
  3889  	// Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
  3890  	//
  3891  	// Any of "anthropic", "custom".
  3892  	Type BetaContainerSkillType `json:"type" api:"required"`
  3893  	// The resolved version: a skill version ID for custom skills.
  3894  	Version string `json:"version" api:"required"`
  3895  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  3896  	JSON struct {
  3897  		SkillID     respjson.Field
  3898  		Type        respjson.Field
  3899  		Version     respjson.Field
  3900  		ExtraFields map[string]respjson.Field
  3901  		raw         string
  3902  	} `json:"-"`
  3903  }
  3904  
  3905  // Returns the unmodified JSON received from the API
  3906  func (r BetaContainerSkill) RawJSON() string { return r.JSON.raw }
  3907  func (r *BetaContainerSkill) UnmarshalJSON(data []byte) error {
  3908  	return apijson.UnmarshalRoot(data, r)
  3909  }
  3910  
  3911  // Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
  3912  type BetaContainerSkillType string
  3913  
  3914  const (
  3915  	BetaContainerSkillTypeAnthropic BetaContainerSkillType = "anthropic"
  3916  	BetaContainerSkillTypeCustom    BetaContainerSkillType = "custom"
  3917  )
  3918  
  3919  // Response model for a file uploaded to the container.
  3920  type BetaContainerUploadBlock struct {
  3921  	FileID string                   `json:"file_id" api:"required"`
  3922  	Type   constant.ContainerUpload `json:"type" default:"container_upload"`
  3923  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  3924  	JSON struct {
  3925  		FileID      respjson.Field
  3926  		Type        respjson.Field
  3927  		ExtraFields map[string]respjson.Field
  3928  		raw         string
  3929  	} `json:"-"`
  3930  }
  3931  
  3932  // Returns the unmodified JSON received from the API
  3933  func (r BetaContainerUploadBlock) RawJSON() string { return r.JSON.raw }
  3934  func (r *BetaContainerUploadBlock) UnmarshalJSON(data []byte) error {
  3935  	return apijson.UnmarshalRoot(data, r)
  3936  }
  3937  
  3938  // A content block that represents a file to be uploaded to the container Files
  3939  // uploaded via this block will be available in the container's input directory.
  3940  //
  3941  // The properties FileID, Type are required.
  3942  type BetaContainerUploadBlockParam struct {
  3943  	FileID string `json:"file_id" api:"required"`
  3944  	// Create a cache control breakpoint at this content block.
  3945  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  3946  	// This field can be elided, and will marshal its zero value as "container_upload".
  3947  	Type constant.ContainerUpload `json:"type" default:"container_upload"`
  3948  	paramObj
  3949  }
  3950  
  3951  func (r BetaContainerUploadBlockParam) MarshalJSON() (data []byte, err error) {
  3952  	type shadow BetaContainerUploadBlockParam
  3953  	return param.MarshalObject(r, (*shadow)(&r))
  3954  }
  3955  func (r *BetaContainerUploadBlockParam) UnmarshalJSON(data []byte) error {
  3956  	return apijson.UnmarshalRoot(data, r)
  3957  }
  3958  
  3959  // BetaContentBlockUnion contains all possible properties and values from
  3960  // [BetaTextBlock], [BetaThinkingBlock], [BetaRedactedThinkingBlock],
  3961  // [BetaToolUseBlock], [BetaServerToolUseBlock], [BetaWebSearchToolResultBlock],
  3962  // [BetaWebFetchToolResultBlock], [BetaAdvisorToolResultBlock],
  3963  // [BetaCodeExecutionToolResultBlock], [BetaBashCodeExecutionToolResultBlock],
  3964  // [BetaTextEditorCodeExecutionToolResultBlock], [BetaToolSearchToolResultBlock],
  3965  // [BetaMCPToolUseBlock], [BetaMCPToolResultBlock], [BetaContainerUploadBlock],
  3966  // [BetaCompactionBlock], [BetaFallbackBlock].
  3967  //
  3968  // Use the [BetaContentBlockUnion.AsAny] method to switch on the variant.
  3969  //
  3970  // Use the methods beginning with 'As' to cast the union to one of its variants.
  3971  type BetaContentBlockUnion struct {
  3972  	// This field is from variant [BetaTextBlock].
  3973  	Citations []BetaTextCitationUnion `json:"citations"`
  3974  	// This field is from variant [BetaTextBlock].
  3975  	Text string `json:"text"`
  3976  	// Any of "text", "thinking", "redacted_thinking", "tool_use", "server_tool_use",
  3977  	// "web_search_tool_result", "web_fetch_tool_result", "advisor_tool_result",
  3978  	// "code_execution_tool_result", "bash_code_execution_tool_result",
  3979  	// "text_editor_code_execution_tool_result", "tool_search_tool_result",
  3980  	// "mcp_tool_use", "mcp_tool_result", "container_upload", "compaction", "fallback".
  3981  	Type string `json:"type"`
  3982  	// This field is from variant [BetaThinkingBlock].
  3983  	Signature string `json:"signature"`
  3984  	// This field is from variant [BetaThinkingBlock].
  3985  	Thinking string `json:"thinking"`
  3986  	// This field is from variant [BetaRedactedThinkingBlock].
  3987  	Data string `json:"data"`
  3988  	ID   string `json:"id"`
  3989  	// necessary custom code modification
  3990  	Input json.RawMessage `json:"input"`
  3991  	Name  string          `json:"name"`
  3992  	// This field is a union of [BetaToolUseBlockCallerUnion],
  3993  	// [BetaServerToolUseBlockCallerUnion], [BetaWebSearchToolResultBlockCallerUnion],
  3994  	// [BetaWebFetchToolResultBlockCallerUnion]
  3995  	Caller BetaContentBlockUnionCaller `json:"caller"`
  3996  	// This field is from variant [BetaToolUseBlock].
  3997  	ToolsetName string `json:"toolset_name"`
  3998  	// This field is a union of [BetaWebSearchToolResultBlockContentUnion],
  3999  	// [BetaWebFetchToolResultBlockContentUnion],
  4000  	// [BetaAdvisorToolResultBlockContentUnion],
  4001  	// [BetaCodeExecutionToolResultBlockContentUnion],
  4002  	// [BetaBashCodeExecutionToolResultBlockContentUnion],
  4003  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion],
  4004  	// [BetaToolSearchToolResultBlockContentUnion],
  4005  	// [BetaMCPToolResultBlockContentUnion], [string]
  4006  	Content   BetaContentBlockUnionContent `json:"content"`
  4007  	ToolUseID string                       `json:"tool_use_id"`
  4008  	// This field is from variant [BetaMCPToolUseBlock].
  4009  	ServerName string `json:"server_name"`
  4010  	// This field is from variant [BetaMCPToolResultBlock].
  4011  	IsError bool `json:"is_error"`
  4012  	// This field is from variant [BetaContainerUploadBlock].
  4013  	FileID string `json:"file_id"`
  4014  	// This field is from variant [BetaCompactionBlock].
  4015  	EncryptedContent string `json:"encrypted_content"`
  4016  	// This field is from variant [BetaFallbackBlock].
  4017  	From BetaFallbackInfo `json:"from"`
  4018  	// This field is from variant [BetaFallbackBlock].
  4019  	To BetaFallbackInfo `json:"to"`
  4020  	// This field is from variant [BetaFallbackBlock].
  4021  	Trigger BetaFallbackRefusalTrigger `json:"trigger"`
  4022  	JSON    struct {
  4023  		Citations        respjson.Field
  4024  		Text             respjson.Field
  4025  		Type             respjson.Field
  4026  		Signature        respjson.Field
  4027  		Thinking         respjson.Field
  4028  		Data             respjson.Field
  4029  		ID               respjson.Field
  4030  		Input            respjson.Field
  4031  		Name             respjson.Field
  4032  		Caller           respjson.Field
  4033  		ToolsetName      respjson.Field
  4034  		Content          respjson.Field
  4035  		ToolUseID        respjson.Field
  4036  		ServerName       respjson.Field
  4037  		IsError          respjson.Field
  4038  		FileID           respjson.Field
  4039  		EncryptedContent respjson.Field
  4040  		From             respjson.Field
  4041  		To               respjson.Field
  4042  		Trigger          respjson.Field
  4043  		raw              string
  4044  	} `json:"-"`
  4045  }
  4046  
  4047  // anyBetaContentBlock is implemented by each variant of [BetaContentBlockUnion] to
  4048  // add type safety for the return type of [BetaContentBlockUnion.AsAny]
  4049  type anyBetaContentBlock interface {
  4050  	implBetaContentBlockUnion()
  4051  	toParamUnion() BetaContentBlockParamUnion
  4052  }
  4053  
  4054  func (BetaTextBlock) implBetaContentBlockUnion()                              {}
  4055  func (BetaThinkingBlock) implBetaContentBlockUnion()                          {}
  4056  func (BetaRedactedThinkingBlock) implBetaContentBlockUnion()                  {}
  4057  func (BetaToolUseBlock) implBetaContentBlockUnion()                           {}
  4058  func (BetaServerToolUseBlock) implBetaContentBlockUnion()                     {}
  4059  func (BetaWebSearchToolResultBlock) implBetaContentBlockUnion()               {}
  4060  func (BetaWebFetchToolResultBlock) implBetaContentBlockUnion()                {}
  4061  func (BetaAdvisorToolResultBlock) implBetaContentBlockUnion()                 {}
  4062  func (BetaCodeExecutionToolResultBlock) implBetaContentBlockUnion()           {}
  4063  func (BetaBashCodeExecutionToolResultBlock) implBetaContentBlockUnion()       {}
  4064  func (BetaTextEditorCodeExecutionToolResultBlock) implBetaContentBlockUnion() {}
  4065  func (BetaToolSearchToolResultBlock) implBetaContentBlockUnion()              {}
  4066  func (BetaMCPToolUseBlock) implBetaContentBlockUnion()                        {}
  4067  func (BetaMCPToolResultBlock) implBetaContentBlockUnion()                     {}
  4068  func (BetaContainerUploadBlock) implBetaContentBlockUnion()                   {}
  4069  func (BetaCompactionBlock) implBetaContentBlockUnion()                        {}
  4070  func (BetaFallbackBlock) implBetaContentBlockUnion()                          {}
  4071  
  4072  // Use the following switch statement to find the correct variant
  4073  //
  4074  //	switch variant := BetaContentBlockUnion.AsAny().(type) {
  4075  //	case anthropic.BetaTextBlock:
  4076  //	case anthropic.BetaThinkingBlock:
  4077  //	case anthropic.BetaRedactedThinkingBlock:
  4078  //	case anthropic.BetaToolUseBlock:
  4079  //	case anthropic.BetaServerToolUseBlock:
  4080  //	case anthropic.BetaWebSearchToolResultBlock:
  4081  //	case anthropic.BetaWebFetchToolResultBlock:
  4082  //	case anthropic.BetaAdvisorToolResultBlock:
  4083  //	case anthropic.BetaCodeExecutionToolResultBlock:
  4084  //	case anthropic.BetaBashCodeExecutionToolResultBlock:
  4085  //	case anthropic.BetaTextEditorCodeExecutionToolResultBlock:
  4086  //	case anthropic.BetaToolSearchToolResultBlock:
  4087  //	case anthropic.BetaMCPToolUseBlock:
  4088  //	case anthropic.BetaMCPToolResultBlock:
  4089  //	case anthropic.BetaContainerUploadBlock:
  4090  //	case anthropic.BetaCompactionBlock:
  4091  //	case anthropic.BetaFallbackBlock:
  4092  //	default:
  4093  //	  fmt.Errorf("no variant present")
  4094  //	}
  4095  func (u BetaContentBlockUnion) AsAny() anyBetaContentBlock {
  4096  	switch u.Type {
  4097  	case "text":
  4098  		return u.AsText()
  4099  	case "thinking":
  4100  		return u.AsThinking()
  4101  	case "redacted_thinking":
  4102  		return u.AsRedactedThinking()
  4103  	case "tool_use":
  4104  		return u.AsToolUse()
  4105  	case "server_tool_use":
  4106  		return u.AsServerToolUse()
  4107  	case "web_search_tool_result":
  4108  		return u.AsWebSearchToolResult()
  4109  	case "web_fetch_tool_result":
  4110  		return u.AsWebFetchToolResult()
  4111  	case "advisor_tool_result":
  4112  		return u.AsAdvisorToolResult()
  4113  	case "code_execution_tool_result":
  4114  		return u.AsCodeExecutionToolResult()
  4115  	case "bash_code_execution_tool_result":
  4116  		return u.AsBashCodeExecutionToolResult()
  4117  	case "text_editor_code_execution_tool_result":
  4118  		return u.AsTextEditorCodeExecutionToolResult()
  4119  	case "tool_search_tool_result":
  4120  		return u.AsToolSearchToolResult()
  4121  	case "mcp_tool_use":
  4122  		return u.AsMCPToolUse()
  4123  	case "mcp_tool_result":
  4124  		return u.AsMCPToolResult()
  4125  	case "container_upload":
  4126  		return u.AsContainerUpload()
  4127  	case "compaction":
  4128  		return u.AsCompaction()
  4129  	case "fallback":
  4130  		return u.AsFallback()
  4131  	}
  4132  	return nil
  4133  }
  4134  
  4135  func (u BetaContentBlockUnion) AsText() (v BetaTextBlock) {
  4136  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4137  	return
  4138  }
  4139  
  4140  func (u BetaContentBlockUnion) AsThinking() (v BetaThinkingBlock) {
  4141  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4142  	return
  4143  }
  4144  
  4145  func (u BetaContentBlockUnion) AsRedactedThinking() (v BetaRedactedThinkingBlock) {
  4146  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4147  	return
  4148  }
  4149  
  4150  func (u BetaContentBlockUnion) AsToolUse() (v BetaToolUseBlock) {
  4151  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4152  	return
  4153  }
  4154  
  4155  func (u BetaContentBlockUnion) AsServerToolUse() (v BetaServerToolUseBlock) {
  4156  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4157  	return
  4158  }
  4159  
  4160  func (u BetaContentBlockUnion) AsWebSearchToolResult() (v BetaWebSearchToolResultBlock) {
  4161  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4162  	return
  4163  }
  4164  
  4165  func (u BetaContentBlockUnion) AsWebFetchToolResult() (v BetaWebFetchToolResultBlock) {
  4166  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4167  	return
  4168  }
  4169  
  4170  func (u BetaContentBlockUnion) AsAdvisorToolResult() (v BetaAdvisorToolResultBlock) {
  4171  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4172  	return
  4173  }
  4174  
  4175  func (u BetaContentBlockUnion) AsCodeExecutionToolResult() (v BetaCodeExecutionToolResultBlock) {
  4176  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4177  	return
  4178  }
  4179  
  4180  func (u BetaContentBlockUnion) AsBashCodeExecutionToolResult() (v BetaBashCodeExecutionToolResultBlock) {
  4181  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4182  	return
  4183  }
  4184  
  4185  func (u BetaContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v BetaTextEditorCodeExecutionToolResultBlock) {
  4186  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4187  	return
  4188  }
  4189  
  4190  func (u BetaContentBlockUnion) AsToolSearchToolResult() (v BetaToolSearchToolResultBlock) {
  4191  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4192  	return
  4193  }
  4194  
  4195  func (u BetaContentBlockUnion) AsMCPToolUse() (v BetaMCPToolUseBlock) {
  4196  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4197  	return
  4198  }
  4199  
  4200  func (u BetaContentBlockUnion) AsMCPToolResult() (v BetaMCPToolResultBlock) {
  4201  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4202  	return
  4203  }
  4204  
  4205  func (u BetaContentBlockUnion) AsContainerUpload() (v BetaContainerUploadBlock) {
  4206  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4207  	return
  4208  }
  4209  
  4210  func (u BetaContentBlockUnion) AsCompaction() (v BetaCompactionBlock) {
  4211  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4212  	return
  4213  }
  4214  
  4215  func (u BetaContentBlockUnion) AsFallback() (v BetaFallbackBlock) {
  4216  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  4217  	return
  4218  }
  4219  
  4220  // Returns the unmodified JSON received from the API
  4221  func (u BetaContentBlockUnion) RawJSON() string { return u.JSON.raw }
  4222  
  4223  func (r *BetaContentBlockUnion) UnmarshalJSON(data []byte) error {
  4224  	return apijson.UnmarshalRoot(data, r)
  4225  }
  4226  
  4227  // BetaContentBlockUnionCaller is an implicit subunion of [BetaContentBlockUnion].
  4228  // BetaContentBlockUnionCaller provides convenient access to the sub-properties of
  4229  // the union.
  4230  //
  4231  // For type safety it is recommended to directly use a variant of the
  4232  // [BetaContentBlockUnion].
  4233  type BetaContentBlockUnionCaller struct {
  4234  	Type   string `json:"type"`
  4235  	ToolID string `json:"tool_id"`
  4236  	JSON   struct {
  4237  		Type   respjson.Field
  4238  		ToolID respjson.Field
  4239  		raw    string
  4240  	} `json:"-"`
  4241  }
  4242  
  4243  func (r *BetaContentBlockUnionCaller) UnmarshalJSON(data []byte) error {
  4244  	return apijson.UnmarshalRoot(data, r)
  4245  }
  4246  
  4247  // BetaContentBlockUnionContent is an implicit subunion of [BetaContentBlockUnion].
  4248  // BetaContentBlockUnionContent provides convenient access to the sub-properties of
  4249  // the union.
  4250  //
  4251  // For type safety it is recommended to directly use a variant of the
  4252  // [BetaContentBlockUnion].
  4253  //
  4254  // If the underlying value is not a json object, one of the following properties
  4255  // will be valid: OfBetaWebSearchResultBlockArray OfString
  4256  // OfBetaMCPToolResultBlockContent]
  4257  type BetaContentBlockUnionContent struct {
  4258  	// This field will be present if the value is a [[]BetaWebSearchResultBlock]
  4259  	// instead of an object.
  4260  	OfBetaWebSearchResultBlockArray []BetaWebSearchResultBlock `json:",inline"`
  4261  	// This field will be present if the value is a [string] instead of an object.
  4262  	OfString string `json:",inline"`
  4263  	// This field will be present if the value is a [[]BetaTextBlock] instead of an
  4264  	// object.
  4265  	OfBetaMCPToolResultBlockContent []BetaTextBlock `json:",inline"`
  4266  	ErrorCode                       string          `json:"error_code"`
  4267  	Type                            string          `json:"type"`
  4268  	// This field is a union of [BetaDocumentBlock], [[]BetaCodeExecutionOutputBlock],
  4269  	// [[]BetaCodeExecutionOutputBlock], [[]BetaBashCodeExecutionOutputBlock], [string]
  4270  	Content BetaContentBlockUnionContentContent `json:"content"`
  4271  	// This field is from variant [BetaWebFetchToolResultBlockContentUnion].
  4272  	RetrievedAt string `json:"retrieved_at"`
  4273  	// This field is from variant [BetaWebFetchToolResultBlockContentUnion].
  4274  	URL        string `json:"url"`
  4275  	StopReason string `json:"stop_reason"`
  4276  	// This field is from variant [BetaAdvisorToolResultBlockContentUnion].
  4277  	Text string `json:"text"`
  4278  	// This field is from variant [BetaAdvisorToolResultBlockContentUnion].
  4279  	EncryptedContent string `json:"encrypted_content"`
  4280  	ReturnCode       int64  `json:"return_code"`
  4281  	Stderr           string `json:"stderr"`
  4282  	Stdout           string `json:"stdout"`
  4283  	// This field is from variant [BetaCodeExecutionToolResultBlockContentUnion].
  4284  	EncryptedStdout string `json:"encrypted_stdout"`
  4285  	ErrorMessage    string `json:"error_message"`
  4286  	// This field is from variant
  4287  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4288  	FileType BetaTextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
  4289  	// This field is from variant
  4290  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4291  	NumLines int64 `json:"num_lines"`
  4292  	// This field is from variant
  4293  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4294  	StartLine int64 `json:"start_line"`
  4295  	// This field is from variant
  4296  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4297  	TotalLines int64 `json:"total_lines"`
  4298  	// This field is from variant
  4299  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4300  	IsFileUpdate bool `json:"is_file_update"`
  4301  	// This field is from variant
  4302  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4303  	Lines []string `json:"lines"`
  4304  	// This field is from variant
  4305  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4306  	NewLines int64 `json:"new_lines"`
  4307  	// This field is from variant
  4308  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4309  	NewStart int64 `json:"new_start"`
  4310  	// This field is from variant
  4311  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4312  	OldLines int64 `json:"old_lines"`
  4313  	// This field is from variant
  4314  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  4315  	OldStart int64 `json:"old_start"`
  4316  	// This field is from variant [BetaToolSearchToolResultBlockContentUnion].
  4317  	ToolReferences []BetaToolReferenceBlock `json:"tool_references"`
  4318  	JSON           struct {
  4319  		OfBetaWebSearchResultBlockArray respjson.Field
  4320  		OfString                        respjson.Field
  4321  		OfBetaMCPToolResultBlockContent respjson.Field
  4322  		ErrorCode                       respjson.Field
  4323  		Type                            respjson.Field
  4324  		Content                         respjson.Field
  4325  		RetrievedAt                     respjson.Field
  4326  		URL                             respjson.Field
  4327  		StopReason                      respjson.Field
  4328  		Text                            respjson.Field
  4329  		EncryptedContent                respjson.Field
  4330  		ReturnCode                      respjson.Field
  4331  		Stderr                          respjson.Field
  4332  		Stdout                          respjson.Field
  4333  		EncryptedStdout                 respjson.Field
  4334  		ErrorMessage                    respjson.Field
  4335  		FileType                        respjson.Field
  4336  		NumLines                        respjson.Field
  4337  		StartLine                       respjson.Field
  4338  		TotalLines                      respjson.Field
  4339  		IsFileUpdate                    respjson.Field
  4340  		Lines                           respjson.Field
  4341  		NewLines                        respjson.Field
  4342  		NewStart                        respjson.Field
  4343  		OldLines                        respjson.Field
  4344  		OldStart                        respjson.Field
  4345  		ToolReferences                  respjson.Field
  4346  		raw                             string
  4347  	} `json:"-"`
  4348  }
  4349  
  4350  func (r *BetaContentBlockUnionContent) UnmarshalJSON(data []byte) error {
  4351  	return apijson.UnmarshalRoot(data, r)
  4352  }
  4353  
  4354  // BetaContentBlockUnionContentContent is an implicit subunion of
  4355  // [BetaContentBlockUnion]. BetaContentBlockUnionContentContent provides convenient
  4356  // access to the sub-properties of the union.
  4357  //
  4358  // For type safety it is recommended to directly use a variant of the
  4359  // [BetaContentBlockUnion].
  4360  //
  4361  // If the underlying value is not a json object, one of the following properties
  4362  // will be valid: OfContent OfString]
  4363  type BetaContentBlockUnionContentContent struct {
  4364  	// This field will be present if the value is a [[]BetaCodeExecutionOutputBlock]
  4365  	// instead of an object.
  4366  	OfContent []BetaCodeExecutionOutputBlock `json:",inline"`
  4367  	// This field will be present if the value is a [string] instead of an object.
  4368  	OfString string `json:",inline"`
  4369  	// This field is from variant [BetaDocumentBlock].
  4370  	Citations BetaCitationConfig `json:"citations"`
  4371  	// This field is from variant [BetaDocumentBlock].
  4372  	Source BetaDocumentBlockSourceUnion `json:"source"`
  4373  	// This field is from variant [BetaDocumentBlock].
  4374  	Title string `json:"title"`
  4375  	// This field is from variant [BetaDocumentBlock].
  4376  	Type constant.Document `json:"type"`
  4377  	JSON struct {
  4378  		OfContent respjson.Field
  4379  		OfString  respjson.Field
  4380  		Citations respjson.Field
  4381  		Source    respjson.Field
  4382  		Title     respjson.Field
  4383  		Type      respjson.Field
  4384  		raw       string
  4385  	} `json:"-"`
  4386  }
  4387  
  4388  func (r *BetaContentBlockUnionContentContent) UnmarshalJSON(data []byte) error {
  4389  	return apijson.UnmarshalRoot(data, r)
  4390  }
  4391  
  4392  func NewBetaTextBlock(text string) BetaContentBlockParamUnion {
  4393  	var variant BetaTextBlockParam
  4394  	variant.Text = text
  4395  	return BetaContentBlockParamUnion{OfText: &variant}
  4396  }
  4397  
  4398  func NewBetaImageBlock[
  4399  	T BetaBase64ImageSourceParam | BetaURLImageSourceParam | BetaFileImageSourceParam,
  4400  ](source T) BetaContentBlockParamUnion {
  4401  	var image BetaImageBlockParam
  4402  	switch v := any(source).(type) {
  4403  	case BetaBase64ImageSourceParam:
  4404  		image.Source.OfBase64 = &v
  4405  	case BetaURLImageSourceParam:
  4406  		image.Source.OfURL = &v
  4407  	case BetaFileImageSourceParam:
  4408  		image.Source.OfFile = &v
  4409  	}
  4410  	return BetaContentBlockParamUnion{OfImage: &image}
  4411  }
  4412  
  4413  func NewBetaDocumentBlock[
  4414  	T BetaBase64PDFSourceParam | BetaPlainTextSourceParam | BetaContentBlockSourceParam | BetaURLPDFSourceParam | BetaFileDocumentSourceParam,
  4415  ](source T) BetaContentBlockParamUnion {
  4416  	var document BetaRequestDocumentBlockParam
  4417  	switch v := any(source).(type) {
  4418  	case BetaBase64PDFSourceParam:
  4419  		document.Source.OfBase64 = &v
  4420  	case BetaPlainTextSourceParam:
  4421  		document.Source.OfText = &v
  4422  	case BetaContentBlockSourceParam:
  4423  		document.Source.OfContent = &v
  4424  	case BetaURLPDFSourceParam:
  4425  		document.Source.OfURL = &v
  4426  	case BetaFileDocumentSourceParam:
  4427  		document.Source.OfFile = &v
  4428  	}
  4429  	return BetaContentBlockParamUnion{OfDocument: &document}
  4430  }
  4431  
  4432  func NewBetaSearchResultBlock(content []BetaTextBlockParam, source string, title string) BetaContentBlockParamUnion {
  4433  	var searchResult BetaSearchResultBlockParam
  4434  	searchResult.Content = content
  4435  	searchResult.Source = source
  4436  	searchResult.Title = title
  4437  	return BetaContentBlockParamUnion{OfSearchResult: &searchResult}
  4438  }
  4439  
  4440  func NewBetaThinkingBlock(signature string, thinking string) BetaContentBlockParamUnion {
  4441  	var variant BetaThinkingBlockParam
  4442  	variant.Signature = signature
  4443  	variant.Thinking = thinking
  4444  	return BetaContentBlockParamUnion{OfThinking: &variant}
  4445  }
  4446  
  4447  func NewBetaRedactedThinkingBlock(data string) BetaContentBlockParamUnion {
  4448  	var redactedThinking BetaRedactedThinkingBlockParam
  4449  	redactedThinking.Data = data
  4450  	return BetaContentBlockParamUnion{OfRedactedThinking: &redactedThinking}
  4451  }
  4452  
  4453  func NewBetaToolUseBlock(id string, input any, name string) BetaContentBlockParamUnion {
  4454  	var toolUse BetaToolUseBlockParam
  4455  	toolUse.ID = id
  4456  	toolUse.Input = input
  4457  	toolUse.Name = name
  4458  	return BetaContentBlockParamUnion{OfToolUse: &toolUse}
  4459  }
  4460  
  4461  func NewBetaToolResultBlock(toolUseID string, content string, isError bool) BetaContentBlockParamUnion {
  4462  	var toolBlock BetaToolResultBlockParam
  4463  	toolBlock.ToolUseID = toolUseID
  4464  	toolBlock.Content = []BetaToolResultBlockParamContentUnion{
  4465  		{OfText: &BetaTextBlockParam{Text: content}},
  4466  	}
  4467  	toolBlock.IsError = Bool(isError)
  4468  	return BetaContentBlockParamUnion{OfToolResult: &toolBlock}
  4469  }
  4470  
  4471  func NewBetaServerToolUseBlock(id string, input any, name BetaServerToolUseBlockParamName) BetaContentBlockParamUnion {
  4472  	var serverToolUse BetaServerToolUseBlockParam
  4473  	serverToolUse.ID = id
  4474  	serverToolUse.Input = input
  4475  	serverToolUse.Name = name
  4476  	return BetaContentBlockParamUnion{OfServerToolUse: &serverToolUse}
  4477  }
  4478  
  4479  func NewBetaWebSearchToolResultBlock[
  4480  	T []BetaWebSearchResultBlockParam | BetaWebSearchToolRequestErrorParam,
  4481  ](content T, toolUseID string) BetaContentBlockParamUnion {
  4482  	var webSearchToolResult BetaWebSearchToolResultBlockParam
  4483  	switch v := any(content).(type) {
  4484  	case []BetaWebSearchResultBlockParam:
  4485  		webSearchToolResult.Content.OfResultBlock = v
  4486  	case BetaWebSearchToolRequestErrorParam:
  4487  		webSearchToolResult.Content.OfError = &v
  4488  	}
  4489  	webSearchToolResult.ToolUseID = toolUseID
  4490  	return BetaContentBlockParamUnion{OfWebSearchToolResult: &webSearchToolResult}
  4491  }
  4492  
  4493  func NewBetaWebFetchToolResultBlock[
  4494  	T BetaWebFetchToolResultErrorBlockParam | BetaWebFetchBlockParam,
  4495  ](content T, toolUseID string) BetaContentBlockParamUnion {
  4496  	var webFetchToolResult BetaWebFetchToolResultBlockParam
  4497  	switch v := any(content).(type) {
  4498  	case BetaWebFetchToolResultErrorBlockParam:
  4499  		webFetchToolResult.Content.OfRequestWebFetchToolResultError = &v
  4500  	case BetaWebFetchBlockParam:
  4501  		webFetchToolResult.Content.OfRequestWebFetchResultBlock = &v
  4502  	}
  4503  	webFetchToolResult.ToolUseID = toolUseID
  4504  	return BetaContentBlockParamUnion{OfWebFetchToolResult: &webFetchToolResult}
  4505  }
  4506  
  4507  func NewBetaAdvisorToolResultBlock[
  4508  	T BetaAdvisorToolResultErrorParam | BetaAdvisorResultBlockParam | BetaAdvisorRedactedResultBlockParam,
  4509  ](content T, toolUseID string) BetaContentBlockParamUnion {
  4510  	var advisorToolResult BetaAdvisorToolResultBlockParam
  4511  	switch v := any(content).(type) {
  4512  	case BetaAdvisorToolResultErrorParam:
  4513  		advisorToolResult.Content.OfRequestAdvisorToolResultError = &v
  4514  	case BetaAdvisorResultBlockParam:
  4515  		advisorToolResult.Content.OfRequestAdvisorResultBlock = &v
  4516  	case BetaAdvisorRedactedResultBlockParam:
  4517  		advisorToolResult.Content.OfRequestAdvisorRedactedResultBlock = &v
  4518  	}
  4519  	advisorToolResult.ToolUseID = toolUseID
  4520  	return BetaContentBlockParamUnion{OfAdvisorToolResult: &advisorToolResult}
  4521  }
  4522  
  4523  func NewBetaCodeExecutionToolResultBlock[
  4524  	T BetaCodeExecutionToolResultErrorParam | BetaCodeExecutionResultBlockParam | BetaEncryptedCodeExecutionResultBlockParam,
  4525  ](content T, toolUseID string) BetaContentBlockParamUnion {
  4526  	var codeExecutionToolResult BetaCodeExecutionToolResultBlockParam
  4527  	switch v := any(content).(type) {
  4528  	case BetaCodeExecutionToolResultErrorParam:
  4529  		codeExecutionToolResult.Content.OfError = &v
  4530  	case BetaCodeExecutionResultBlockParam:
  4531  		codeExecutionToolResult.Content.OfResultBlock = &v
  4532  	case BetaEncryptedCodeExecutionResultBlockParam:
  4533  		codeExecutionToolResult.Content.OfRequestEncryptedCodeExecutionResultBlock = &v
  4534  	}
  4535  	codeExecutionToolResult.ToolUseID = toolUseID
  4536  	return BetaContentBlockParamUnion{OfCodeExecutionToolResult: &codeExecutionToolResult}
  4537  }
  4538  
  4539  func NewBetaBashCodeExecutionToolResultBlock[
  4540  	T BetaBashCodeExecutionToolResultErrorParam | BetaBashCodeExecutionResultBlockParam,
  4541  ](content T, toolUseID string) BetaContentBlockParamUnion {
  4542  	var bashCodeExecutionToolResult BetaBashCodeExecutionToolResultBlockParam
  4543  	switch v := any(content).(type) {
  4544  	case BetaBashCodeExecutionToolResultErrorParam:
  4545  		bashCodeExecutionToolResult.Content.OfRequestBashCodeExecutionToolResultError = &v
  4546  	case BetaBashCodeExecutionResultBlockParam:
  4547  		bashCodeExecutionToolResult.Content.OfRequestBashCodeExecutionResultBlock = &v
  4548  	}
  4549  	bashCodeExecutionToolResult.ToolUseID = toolUseID
  4550  	return BetaContentBlockParamUnion{OfBashCodeExecutionToolResult: &bashCodeExecutionToolResult}
  4551  }
  4552  
  4553  func NewBetaTextEditorCodeExecutionToolResultBlock[
  4554  	T BetaTextEditorCodeExecutionToolResultErrorParam | BetaTextEditorCodeExecutionViewResultBlockParam | BetaTextEditorCodeExecutionCreateResultBlockParam | BetaTextEditorCodeExecutionStrReplaceResultBlockParam,
  4555  ](content T, toolUseID string) BetaContentBlockParamUnion {
  4556  	var textEditorCodeExecutionToolResult BetaTextEditorCodeExecutionToolResultBlockParam
  4557  	switch v := any(content).(type) {
  4558  	case BetaTextEditorCodeExecutionToolResultErrorParam:
  4559  		textEditorCodeExecutionToolResult.Content.OfRequestTextEditorCodeExecutionToolResultError = &v
  4560  	case BetaTextEditorCodeExecutionViewResultBlockParam:
  4561  		textEditorCodeExecutionToolResult.Content.OfRequestTextEditorCodeExecutionViewResultBlock = &v
  4562  	case BetaTextEditorCodeExecutionCreateResultBlockParam:
  4563  		textEditorCodeExecutionToolResult.Content.OfRequestTextEditorCodeExecutionCreateResultBlock = &v
  4564  	case BetaTextEditorCodeExecutionStrReplaceResultBlockParam:
  4565  		textEditorCodeExecutionToolResult.Content.OfRequestTextEditorCodeExecutionStrReplaceResultBlock = &v
  4566  	}
  4567  	textEditorCodeExecutionToolResult.ToolUseID = toolUseID
  4568  	return BetaContentBlockParamUnion{OfTextEditorCodeExecutionToolResult: &textEditorCodeExecutionToolResult}
  4569  }
  4570  
  4571  func NewBetaToolSearchToolResultBlock[
  4572  	T BetaToolSearchToolResultErrorParam | BetaToolSearchToolSearchResultBlockParam,
  4573  ](content T, toolUseID string) BetaContentBlockParamUnion {
  4574  	var toolSearchToolResult BetaToolSearchToolResultBlockParam
  4575  	switch v := any(content).(type) {
  4576  	case BetaToolSearchToolResultErrorParam:
  4577  		toolSearchToolResult.Content.OfRequestToolSearchToolResultError = &v
  4578  	case BetaToolSearchToolSearchResultBlockParam:
  4579  		toolSearchToolResult.Content.OfRequestToolSearchToolSearchResultBlock = &v
  4580  	}
  4581  	toolSearchToolResult.ToolUseID = toolUseID
  4582  	return BetaContentBlockParamUnion{OfToolSearchToolResult: &toolSearchToolResult}
  4583  }
  4584  
  4585  func NewBetaMCPToolResultBlock(toolUseID string) BetaContentBlockParamUnion {
  4586  	var mcpToolResult BetaRequestMCPToolResultBlockParam
  4587  	mcpToolResult.ToolUseID = toolUseID
  4588  	return BetaContentBlockParamUnion{OfMCPToolResult: &mcpToolResult}
  4589  }
  4590  
  4591  func NewBetaContainerUploadBlock(fileID string) BetaContentBlockParamUnion {
  4592  	var containerUpload BetaContainerUploadBlockParam
  4593  	containerUpload.FileID = fileID
  4594  	return BetaContentBlockParamUnion{OfContainerUpload: &containerUpload}
  4595  }
  4596  
  4597  func NewBetaToolAdditionBlock[
  4598  	T BetaToolChangeToolReferenceParam | BetaToolChangeMCPToolReferenceParam | BetaToolChangeMCPToolsetReferenceParam,
  4599  ](tool T) BetaContentBlockParamUnion {
  4600  	var toolAddition BetaRequestToolAdditionBlockParam
  4601  	switch v := any(tool).(type) {
  4602  	case BetaToolChangeToolReferenceParam:
  4603  		toolAddition.Tool.OfToolReference = &v
  4604  	case BetaToolChangeMCPToolReferenceParam:
  4605  		toolAddition.Tool.OfMCPToolReference = &v
  4606  	case BetaToolChangeMCPToolsetReferenceParam:
  4607  		toolAddition.Tool.OfMCPToolsetReference = &v
  4608  	}
  4609  	return BetaContentBlockParamUnion{OfToolAddition: &toolAddition}
  4610  }
  4611  
  4612  func NewBetaToolRemovalBlock[
  4613  	T BetaToolChangeToolReferenceParam | BetaToolChangeMCPToolReferenceParam | BetaToolChangeMCPToolsetReferenceParam,
  4614  ](tool T) BetaContentBlockParamUnion {
  4615  	var toolRemoval BetaRequestToolRemovalBlockParam
  4616  	switch v := any(tool).(type) {
  4617  	case BetaToolChangeToolReferenceParam:
  4618  		toolRemoval.Tool.OfToolReference = &v
  4619  	case BetaToolChangeMCPToolReferenceParam:
  4620  		toolRemoval.Tool.OfMCPToolReference = &v
  4621  	case BetaToolChangeMCPToolsetReferenceParam:
  4622  		toolRemoval.Tool.OfMCPToolsetReference = &v
  4623  	}
  4624  	return BetaContentBlockParamUnion{OfToolRemoval: &toolRemoval}
  4625  }
  4626  
  4627  func NewBetaFallbackBlock(from BetaFallbackInfoParam, to BetaFallbackInfoParam) BetaContentBlockParamUnion {
  4628  	var fallback BetaFallbackBlockParam
  4629  	fallback.From = from
  4630  	fallback.To = to
  4631  	return BetaContentBlockParamUnion{OfFallback: &fallback}
  4632  }
  4633  
  4634  // Only one field can be non-zero.
  4635  //
  4636  // Use [param.IsOmitted] to confirm if a field is set.
  4637  type BetaContentBlockParamUnion struct {
  4638  	OfText                              *BetaTextBlockParam                              `json:",omitzero,inline"`
  4639  	OfImage                             *BetaImageBlockParam                             `json:",omitzero,inline"`
  4640  	OfDocument                          *BetaRequestDocumentBlockParam                   `json:",omitzero,inline"`
  4641  	OfSearchResult                      *BetaSearchResultBlockParam                      `json:",omitzero,inline"`
  4642  	OfThinking                          *BetaThinkingBlockParam                          `json:",omitzero,inline"`
  4643  	OfRedactedThinking                  *BetaRedactedThinkingBlockParam                  `json:",omitzero,inline"`
  4644  	OfToolUse                           *BetaToolUseBlockParam                           `json:",omitzero,inline"`
  4645  	OfToolResult                        *BetaToolResultBlockParam                        `json:",omitzero,inline"`
  4646  	OfServerToolUse                     *BetaServerToolUseBlockParam                     `json:",omitzero,inline"`
  4647  	OfWebSearchToolResult               *BetaWebSearchToolResultBlockParam               `json:",omitzero,inline"`
  4648  	OfWebFetchToolResult                *BetaWebFetchToolResultBlockParam                `json:",omitzero,inline"`
  4649  	OfAdvisorToolResult                 *BetaAdvisorToolResultBlockParam                 `json:",omitzero,inline"`
  4650  	OfCodeExecutionToolResult           *BetaCodeExecutionToolResultBlockParam           `json:",omitzero,inline"`
  4651  	OfBashCodeExecutionToolResult       *BetaBashCodeExecutionToolResultBlockParam       `json:",omitzero,inline"`
  4652  	OfTextEditorCodeExecutionToolResult *BetaTextEditorCodeExecutionToolResultBlockParam `json:",omitzero,inline"`
  4653  	OfToolSearchToolResult              *BetaToolSearchToolResultBlockParam              `json:",omitzero,inline"`
  4654  	OfMCPToolUse                        *BetaMCPToolUseBlockParam                        `json:",omitzero,inline"`
  4655  	OfMCPToolResult                     *BetaRequestMCPToolResultBlockParam              `json:",omitzero,inline"`
  4656  	OfContainerUpload                   *BetaContainerUploadBlockParam                   `json:",omitzero,inline"`
  4657  	OfCompaction                        *BetaCompactionBlockParam                        `json:",omitzero,inline"`
  4658  	OfToolAddition                      *BetaRequestToolAdditionBlockParam               `json:",omitzero,inline"`
  4659  	OfToolRemoval                       *BetaRequestToolRemovalBlockParam                `json:",omitzero,inline"`
  4660  	OfFallback                          *BetaFallbackBlockParam                          `json:",omitzero,inline"`
  4661  	paramUnion
  4662  }
  4663  
  4664  func (u BetaContentBlockParamUnion) MarshalJSON() ([]byte, error) {
  4665  	return param.MarshalUnion(u, u.OfText,
  4666  		u.OfImage,
  4667  		u.OfDocument,
  4668  		u.OfSearchResult,
  4669  		u.OfThinking,
  4670  		u.OfRedactedThinking,
  4671  		u.OfToolUse,
  4672  		u.OfToolResult,
  4673  		u.OfServerToolUse,
  4674  		u.OfWebSearchToolResult,
  4675  		u.OfWebFetchToolResult,
  4676  		u.OfAdvisorToolResult,
  4677  		u.OfCodeExecutionToolResult,
  4678  		u.OfBashCodeExecutionToolResult,
  4679  		u.OfTextEditorCodeExecutionToolResult,
  4680  		u.OfToolSearchToolResult,
  4681  		u.OfMCPToolUse,
  4682  		u.OfMCPToolResult,
  4683  		u.OfContainerUpload,
  4684  		u.OfCompaction,
  4685  		u.OfToolAddition,
  4686  		u.OfToolRemoval,
  4687  		u.OfFallback)
  4688  }
  4689  func (u *BetaContentBlockParamUnion) UnmarshalJSON(data []byte) error {
  4690  	return apijson.UnmarshalRoot(data, u)
  4691  }
  4692  
  4693  func (u *BetaContentBlockParamUnion) asAny() any {
  4694  	if !param.IsOmitted(u.OfText) {
  4695  		return u.OfText
  4696  	} else if !param.IsOmitted(u.OfImage) {
  4697  		return u.OfImage
  4698  	} else if !param.IsOmitted(u.OfDocument) {
  4699  		return u.OfDocument
  4700  	} else if !param.IsOmitted(u.OfSearchResult) {
  4701  		return u.OfSearchResult
  4702  	} else if !param.IsOmitted(u.OfThinking) {
  4703  		return u.OfThinking
  4704  	} else if !param.IsOmitted(u.OfRedactedThinking) {
  4705  		return u.OfRedactedThinking
  4706  	} else if !param.IsOmitted(u.OfToolUse) {
  4707  		return u.OfToolUse
  4708  	} else if !param.IsOmitted(u.OfToolResult) {
  4709  		return u.OfToolResult
  4710  	} else if !param.IsOmitted(u.OfServerToolUse) {
  4711  		return u.OfServerToolUse
  4712  	} else if !param.IsOmitted(u.OfWebSearchToolResult) {
  4713  		return u.OfWebSearchToolResult
  4714  	} else if !param.IsOmitted(u.OfWebFetchToolResult) {
  4715  		return u.OfWebFetchToolResult
  4716  	} else if !param.IsOmitted(u.OfAdvisorToolResult) {
  4717  		return u.OfAdvisorToolResult
  4718  	} else if !param.IsOmitted(u.OfCodeExecutionToolResult) {
  4719  		return u.OfCodeExecutionToolResult
  4720  	} else if !param.IsOmitted(u.OfBashCodeExecutionToolResult) {
  4721  		return u.OfBashCodeExecutionToolResult
  4722  	} else if !param.IsOmitted(u.OfTextEditorCodeExecutionToolResult) {
  4723  		return u.OfTextEditorCodeExecutionToolResult
  4724  	} else if !param.IsOmitted(u.OfToolSearchToolResult) {
  4725  		return u.OfToolSearchToolResult
  4726  	} else if !param.IsOmitted(u.OfMCPToolUse) {
  4727  		return u.OfMCPToolUse
  4728  	} else if !param.IsOmitted(u.OfMCPToolResult) {
  4729  		return u.OfMCPToolResult
  4730  	} else if !param.IsOmitted(u.OfContainerUpload) {
  4731  		return u.OfContainerUpload
  4732  	} else if !param.IsOmitted(u.OfCompaction) {
  4733  		return u.OfCompaction
  4734  	} else if !param.IsOmitted(u.OfToolAddition) {
  4735  		return u.OfToolAddition
  4736  	} else if !param.IsOmitted(u.OfToolRemoval) {
  4737  		return u.OfToolRemoval
  4738  	} else if !param.IsOmitted(u.OfFallback) {
  4739  		return u.OfFallback
  4740  	}
  4741  	return nil
  4742  }
  4743  
  4744  // Returns a pointer to the underlying variant's property, if present.
  4745  func (u BetaContentBlockParamUnion) GetText() *string {
  4746  	if vt := u.OfText; vt != nil {
  4747  		return &vt.Text
  4748  	}
  4749  	return nil
  4750  }
  4751  
  4752  // Returns a pointer to the underlying variant's property, if present.
  4753  func (u BetaContentBlockParamUnion) GetTransformations() *BetaImageTransformationsParam {
  4754  	if vt := u.OfImage; vt != nil {
  4755  		return &vt.Transformations
  4756  	}
  4757  	return nil
  4758  }
  4759  
  4760  // Returns a pointer to the underlying variant's property, if present.
  4761  func (u BetaContentBlockParamUnion) GetContext() *string {
  4762  	if vt := u.OfDocument; vt != nil && vt.Context.Valid() {
  4763  		return &vt.Context.Value
  4764  	}
  4765  	return nil
  4766  }
  4767  
  4768  // Returns a pointer to the underlying variant's property, if present.
  4769  func (u BetaContentBlockParamUnion) GetSignature() *string {
  4770  	if vt := u.OfThinking; vt != nil {
  4771  		return &vt.Signature
  4772  	}
  4773  	return nil
  4774  }
  4775  
  4776  // Returns a pointer to the underlying variant's property, if present.
  4777  func (u BetaContentBlockParamUnion) GetThinking() *string {
  4778  	if vt := u.OfThinking; vt != nil {
  4779  		return &vt.Thinking
  4780  	}
  4781  	return nil
  4782  }
  4783  
  4784  // Returns a pointer to the underlying variant's property, if present.
  4785  func (u BetaContentBlockParamUnion) GetData() *string {
  4786  	if vt := u.OfRedactedThinking; vt != nil {
  4787  		return &vt.Data
  4788  	}
  4789  	return nil
  4790  }
  4791  
  4792  // Returns a pointer to the underlying variant's property, if present.
  4793  func (u BetaContentBlockParamUnion) GetServerName() *string {
  4794  	if vt := u.OfMCPToolUse; vt != nil {
  4795  		return &vt.ServerName
  4796  	}
  4797  	return nil
  4798  }
  4799  
  4800  // Returns a pointer to the underlying variant's property, if present.
  4801  func (u BetaContentBlockParamUnion) GetFileID() *string {
  4802  	if vt := u.OfContainerUpload; vt != nil {
  4803  		return &vt.FileID
  4804  	}
  4805  	return nil
  4806  }
  4807  
  4808  // Returns a pointer to the underlying variant's property, if present.
  4809  func (u BetaContentBlockParamUnion) GetEncryptedContent() *string {
  4810  	if vt := u.OfCompaction; vt != nil && vt.EncryptedContent.Valid() {
  4811  		return &vt.EncryptedContent.Value
  4812  	}
  4813  	return nil
  4814  }
  4815  
  4816  // Returns a pointer to the underlying variant's property, if present.
  4817  func (u BetaContentBlockParamUnion) GetFrom() *BetaFallbackInfoParam {
  4818  	if vt := u.OfFallback; vt != nil {
  4819  		return &vt.From
  4820  	}
  4821  	return nil
  4822  }
  4823  
  4824  // Returns a pointer to the underlying variant's property, if present.
  4825  func (u BetaContentBlockParamUnion) GetTo() *BetaFallbackInfoParam {
  4826  	if vt := u.OfFallback; vt != nil {
  4827  		return &vt.To
  4828  	}
  4829  	return nil
  4830  }
  4831  
  4832  // Returns a pointer to the underlying variant's property, if present.
  4833  func (u BetaContentBlockParamUnion) GetTrigger() *any {
  4834  	if vt := u.OfFallback; vt != nil {
  4835  		return &vt.Trigger
  4836  	}
  4837  	return nil
  4838  }
  4839  
  4840  // Returns a pointer to the underlying variant's property, if present.
  4841  func (u BetaContentBlockParamUnion) GetType() *string {
  4842  	if vt := u.OfText; vt != nil {
  4843  		return (*string)(&vt.Type)
  4844  	} else if vt := u.OfImage; vt != nil {
  4845  		return (*string)(&vt.Type)
  4846  	} else if vt := u.OfDocument; vt != nil {
  4847  		return (*string)(&vt.Type)
  4848  	} else if vt := u.OfSearchResult; vt != nil {
  4849  		return (*string)(&vt.Type)
  4850  	} else if vt := u.OfThinking; vt != nil {
  4851  		return (*string)(&vt.Type)
  4852  	} else if vt := u.OfRedactedThinking; vt != nil {
  4853  		return (*string)(&vt.Type)
  4854  	} else if vt := u.OfToolUse; vt != nil {
  4855  		return (*string)(&vt.Type)
  4856  	} else if vt := u.OfToolResult; vt != nil {
  4857  		return (*string)(&vt.Type)
  4858  	} else if vt := u.OfServerToolUse; vt != nil {
  4859  		return (*string)(&vt.Type)
  4860  	} else if vt := u.OfWebSearchToolResult; vt != nil {
  4861  		return (*string)(&vt.Type)
  4862  	} else if vt := u.OfWebFetchToolResult; vt != nil {
  4863  		return (*string)(&vt.Type)
  4864  	} else if vt := u.OfAdvisorToolResult; vt != nil {
  4865  		return (*string)(&vt.Type)
  4866  	} else if vt := u.OfCodeExecutionToolResult; vt != nil {
  4867  		return (*string)(&vt.Type)
  4868  	} else if vt := u.OfBashCodeExecutionToolResult; vt != nil {
  4869  		return (*string)(&vt.Type)
  4870  	} else if vt := u.OfTextEditorCodeExecutionToolResult; vt != nil {
  4871  		return (*string)(&vt.Type)
  4872  	} else if vt := u.OfToolSearchToolResult; vt != nil {
  4873  		return (*string)(&vt.Type)
  4874  	} else if vt := u.OfMCPToolUse; vt != nil {
  4875  		return (*string)(&vt.Type)
  4876  	} else if vt := u.OfMCPToolResult; vt != nil {
  4877  		return (*string)(&vt.Type)
  4878  	} else if vt := u.OfContainerUpload; vt != nil {
  4879  		return (*string)(&vt.Type)
  4880  	} else if vt := u.OfCompaction; vt != nil {
  4881  		return (*string)(&vt.Type)
  4882  	} else if vt := u.OfToolAddition; vt != nil {
  4883  		return (*string)(&vt.Type)
  4884  	} else if vt := u.OfToolRemoval; vt != nil {
  4885  		return (*string)(&vt.Type)
  4886  	} else if vt := u.OfFallback; vt != nil {
  4887  		return (*string)(&vt.Type)
  4888  	}
  4889  	return nil
  4890  }
  4891  
  4892  // Returns a pointer to the underlying variant's property, if present.
  4893  func (u BetaContentBlockParamUnion) GetTitle() *string {
  4894  	if vt := u.OfDocument; vt != nil && vt.Title.Valid() {
  4895  		return &vt.Title.Value
  4896  	} else if vt := u.OfSearchResult; vt != nil {
  4897  		return (*string)(&vt.Title)
  4898  	}
  4899  	return nil
  4900  }
  4901  
  4902  // Returns a pointer to the underlying variant's property, if present.
  4903  func (u BetaContentBlockParamUnion) GetID() *string {
  4904  	if vt := u.OfToolUse; vt != nil {
  4905  		return (*string)(&vt.ID)
  4906  	} else if vt := u.OfServerToolUse; vt != nil {
  4907  		return (*string)(&vt.ID)
  4908  	} else if vt := u.OfMCPToolUse; vt != nil {
  4909  		return (*string)(&vt.ID)
  4910  	}
  4911  	return nil
  4912  }
  4913  
  4914  // Returns a pointer to the underlying variant's property, if present.
  4915  func (u BetaContentBlockParamUnion) GetName() *string {
  4916  	if vt := u.OfToolUse; vt != nil {
  4917  		return (*string)(&vt.Name)
  4918  	} else if vt := u.OfServerToolUse; vt != nil {
  4919  		return (*string)(&vt.Name)
  4920  	} else if vt := u.OfMCPToolUse; vt != nil {
  4921  		return (*string)(&vt.Name)
  4922  	}
  4923  	return nil
  4924  }
  4925  
  4926  // Returns a pointer to the underlying variant's property, if present.
  4927  func (u BetaContentBlockParamUnion) GetToolsetName() *string {
  4928  	if vt := u.OfToolUse; vt != nil && vt.ToolsetName.Valid() {
  4929  		return &vt.ToolsetName.Value
  4930  	} else if vt := u.OfToolResult; vt != nil && vt.ToolsetName.Valid() {
  4931  		return &vt.ToolsetName.Value
  4932  	}
  4933  	return nil
  4934  }
  4935  
  4936  // Returns a pointer to the underlying variant's property, if present.
  4937  func (u BetaContentBlockParamUnion) GetToolUseID() *string {
  4938  	if vt := u.OfToolResult; vt != nil {
  4939  		return (*string)(&vt.ToolUseID)
  4940  	} else if vt := u.OfWebSearchToolResult; vt != nil {
  4941  		return (*string)(&vt.ToolUseID)
  4942  	} else if vt := u.OfWebFetchToolResult; vt != nil {
  4943  		return (*string)(&vt.ToolUseID)
  4944  	} else if vt := u.OfAdvisorToolResult; vt != nil {
  4945  		return (*string)(&vt.ToolUseID)
  4946  	} else if vt := u.OfCodeExecutionToolResult; vt != nil {
  4947  		return (*string)(&vt.ToolUseID)
  4948  	} else if vt := u.OfBashCodeExecutionToolResult; vt != nil {
  4949  		return (*string)(&vt.ToolUseID)
  4950  	} else if vt := u.OfTextEditorCodeExecutionToolResult; vt != nil {
  4951  		return (*string)(&vt.ToolUseID)
  4952  	} else if vt := u.OfToolSearchToolResult; vt != nil {
  4953  		return (*string)(&vt.ToolUseID)
  4954  	} else if vt := u.OfMCPToolResult; vt != nil {
  4955  		return (*string)(&vt.ToolUseID)
  4956  	}
  4957  	return nil
  4958  }
  4959  
  4960  // Returns a pointer to the underlying variant's property, if present.
  4961  func (u BetaContentBlockParamUnion) GetIsError() *bool {
  4962  	if vt := u.OfToolResult; vt != nil && vt.IsError.Valid() {
  4963  		return &vt.IsError.Value
  4964  	} else if vt := u.OfMCPToolResult; vt != nil && vt.IsError.Valid() {
  4965  		return &vt.IsError.Value
  4966  	}
  4967  	return nil
  4968  }
  4969  
  4970  // Returns a pointer to the underlying variant's CacheControl property, if present.
  4971  func (u BetaContentBlockParamUnion) GetCacheControl() *BetaCacheControlEphemeralParam {
  4972  	if vt := u.OfText; vt != nil {
  4973  		return &vt.CacheControl
  4974  	} else if vt := u.OfImage; vt != nil {
  4975  		return &vt.CacheControl
  4976  	} else if vt := u.OfDocument; vt != nil {
  4977  		return &vt.CacheControl
  4978  	} else if vt := u.OfSearchResult; vt != nil {
  4979  		return &vt.CacheControl
  4980  	} else if vt := u.OfToolUse; vt != nil {
  4981  		return &vt.CacheControl
  4982  	} else if vt := u.OfToolResult; vt != nil {
  4983  		return &vt.CacheControl
  4984  	} else if vt := u.OfServerToolUse; vt != nil {
  4985  		return &vt.CacheControl
  4986  	} else if vt := u.OfWebSearchToolResult; vt != nil {
  4987  		return &vt.CacheControl
  4988  	} else if vt := u.OfWebFetchToolResult; vt != nil {
  4989  		return &vt.CacheControl
  4990  	} else if vt := u.OfAdvisorToolResult; vt != nil {
  4991  		return &vt.CacheControl
  4992  	} else if vt := u.OfCodeExecutionToolResult; vt != nil {
  4993  		return &vt.CacheControl
  4994  	} else if vt := u.OfBashCodeExecutionToolResult; vt != nil {
  4995  		return &vt.CacheControl
  4996  	} else if vt := u.OfTextEditorCodeExecutionToolResult; vt != nil {
  4997  		return &vt.CacheControl
  4998  	} else if vt := u.OfToolSearchToolResult; vt != nil {
  4999  		return &vt.CacheControl
  5000  	} else if vt := u.OfMCPToolUse; vt != nil {
  5001  		return &vt.CacheControl
  5002  	} else if vt := u.OfMCPToolResult; vt != nil {
  5003  		return &vt.CacheControl
  5004  	} else if vt := u.OfContainerUpload; vt != nil {
  5005  		return &vt.CacheControl
  5006  	} else if vt := u.OfCompaction; vt != nil {
  5007  		return &vt.CacheControl
  5008  	} else if vt := u.OfToolAddition; vt != nil {
  5009  		return &vt.CacheControl
  5010  	} else if vt := u.OfToolRemoval; vt != nil {
  5011  		return &vt.CacheControl
  5012  	}
  5013  	return nil
  5014  }
  5015  
  5016  // Returns a subunion which exports methods to access subproperties
  5017  //
  5018  // Or use AsAny() to get the underlying value
  5019  func (u BetaContentBlockParamUnion) GetCitations() (res betaContentBlockParamUnionCitations) {
  5020  	if vt := u.OfText; vt != nil {
  5021  		res.any = &vt.Citations
  5022  	} else if vt := u.OfDocument; vt != nil {
  5023  		res.any = &vt.Citations
  5024  	} else if vt := u.OfSearchResult; vt != nil {
  5025  		res.any = &vt.Citations
  5026  	}
  5027  	return
  5028  }
  5029  
  5030  // Can have the runtime types [*[]BetaTextCitationParamUnion],
  5031  // [*BetaCitationsConfigParam]
  5032  type betaContentBlockParamUnionCitations struct{ any }
  5033  
  5034  // Use the following switch statement to get the type of the union:
  5035  //
  5036  //	switch u.AsAny().(type) {
  5037  //	case *[]anthropic.BetaTextCitationParamUnion:
  5038  //	case *anthropic.BetaCitationsConfigParam:
  5039  //	default:
  5040  //	    fmt.Errorf("not present")
  5041  //	}
  5042  func (u betaContentBlockParamUnionCitations) AsAny() any { return u.any }
  5043  
  5044  // Returns a pointer to the underlying variant's property, if present.
  5045  func (u betaContentBlockParamUnionCitations) GetEnabled() *bool {
  5046  	switch vt := u.any.(type) {
  5047  	case *BetaCitationsConfigParam:
  5048  		return paramutil.AddrIfPresent(vt.Enabled)
  5049  	}
  5050  	return nil
  5051  }
  5052  
  5053  // Returns a subunion which exports methods to access subproperties
  5054  //
  5055  // Or use AsAny() to get the underlying value
  5056  func (u BetaContentBlockParamUnion) GetSource() (res betaContentBlockParamUnionSource) {
  5057  	if vt := u.OfImage; vt != nil {
  5058  		res.any = vt.Source.asAny()
  5059  	} else if vt := u.OfDocument; vt != nil {
  5060  		res.any = vt.Source.asAny()
  5061  	} else if vt := u.OfSearchResult; vt != nil {
  5062  		res.any = &vt.Source
  5063  	}
  5064  	return
  5065  }
  5066  
  5067  // Can have the runtime types [*BetaBase64ImageSourceParam],
  5068  // [*BetaURLImageSourceParam], [*BetaFileImageSourceParam],
  5069  // [*BetaBase64PDFSourceParam], [*BetaPlainTextSourceParam],
  5070  // [*BetaContentBlockSourceParam], [*BetaURLPDFSourceParam],
  5071  // [*BetaFileDocumentSourceParam], [*string]
  5072  type betaContentBlockParamUnionSource struct{ any }
  5073  
  5074  // Use the following switch statement to get the type of the union:
  5075  //
  5076  //	switch u.AsAny().(type) {
  5077  //	case *anthropic.BetaBase64ImageSourceParam:
  5078  //	case *anthropic.BetaURLImageSourceParam:
  5079  //	case *anthropic.BetaFileImageSourceParam:
  5080  //	case *anthropic.BetaBase64PDFSourceParam:
  5081  //	case *anthropic.BetaPlainTextSourceParam:
  5082  //	case *anthropic.BetaContentBlockSourceParam:
  5083  //	case *anthropic.BetaURLPDFSourceParam:
  5084  //	case *anthropic.BetaFileDocumentSourceParam:
  5085  //	case *string:
  5086  //	default:
  5087  //	    fmt.Errorf("not present")
  5088  //	}
  5089  func (u betaContentBlockParamUnionSource) AsAny() any { return u.any }
  5090  
  5091  // Returns a pointer to the underlying variant's property, if present.
  5092  func (u betaContentBlockParamUnionSource) GetContent() *BetaContentBlockSourceContentUnionParam {
  5093  	switch vt := u.any.(type) {
  5094  	case *BetaRequestDocumentBlockSourceUnionParam:
  5095  		return vt.GetContent()
  5096  	}
  5097  	return nil
  5098  }
  5099  
  5100  // Returns a pointer to the underlying variant's property, if present.
  5101  func (u betaContentBlockParamUnionSource) GetData() *string {
  5102  	switch vt := u.any.(type) {
  5103  	case *BetaImageBlockParamSourceUnion:
  5104  		return vt.GetData()
  5105  	case *BetaRequestDocumentBlockSourceUnionParam:
  5106  		return vt.GetData()
  5107  	}
  5108  	return nil
  5109  }
  5110  
  5111  // Returns a pointer to the underlying variant's property, if present.
  5112  func (u betaContentBlockParamUnionSource) GetMediaType() *string {
  5113  	switch vt := u.any.(type) {
  5114  	case *BetaImageBlockParamSourceUnion:
  5115  		return vt.GetMediaType()
  5116  	case *BetaRequestDocumentBlockSourceUnionParam:
  5117  		return vt.GetMediaType()
  5118  	}
  5119  	return nil
  5120  }
  5121  
  5122  // Returns a pointer to the underlying variant's property, if present.
  5123  func (u betaContentBlockParamUnionSource) GetType() *string {
  5124  	switch vt := u.any.(type) {
  5125  	case *BetaImageBlockParamSourceUnion:
  5126  		return vt.GetType()
  5127  	case *BetaRequestDocumentBlockSourceUnionParam:
  5128  		return vt.GetType()
  5129  	}
  5130  	return nil
  5131  }
  5132  
  5133  // Returns a pointer to the underlying variant's property, if present.
  5134  func (u betaContentBlockParamUnionSource) GetURL() *string {
  5135  	switch vt := u.any.(type) {
  5136  	case *BetaImageBlockParamSourceUnion:
  5137  		return vt.GetURL()
  5138  	case *BetaRequestDocumentBlockSourceUnionParam:
  5139  		return vt.GetURL()
  5140  	}
  5141  	return nil
  5142  }
  5143  
  5144  // Returns a pointer to the underlying variant's property, if present.
  5145  func (u betaContentBlockParamUnionSource) GetFileID() *string {
  5146  	switch vt := u.any.(type) {
  5147  	case *BetaImageBlockParamSourceUnion:
  5148  		return vt.GetFileID()
  5149  	case *BetaRequestDocumentBlockSourceUnionParam:
  5150  		return vt.GetFileID()
  5151  	}
  5152  	return nil
  5153  }
  5154  
  5155  // Returns a subunion which exports methods to access subproperties
  5156  //
  5157  // Or use AsAny() to get the underlying value
  5158  func (u BetaContentBlockParamUnion) GetContent() (res betaContentBlockParamUnionContent) {
  5159  	if vt := u.OfSearchResult; vt != nil {
  5160  		res.any = &vt.Content
  5161  	} else if vt := u.OfToolResult; vt != nil {
  5162  		res.any = &vt.Content
  5163  	} else if vt := u.OfWebSearchToolResult; vt != nil {
  5164  		res.any = vt.Content.asAny()
  5165  	} else if vt := u.OfWebFetchToolResult; vt != nil {
  5166  		res.any = vt.Content.asAny()
  5167  	} else if vt := u.OfAdvisorToolResult; vt != nil {
  5168  		res.any = vt.Content.asAny()
  5169  	} else if vt := u.OfCodeExecutionToolResult; vt != nil {
  5170  		res.any = vt.Content.asAny()
  5171  	} else if vt := u.OfBashCodeExecutionToolResult; vt != nil {
  5172  		res.any = vt.Content.asAny()
  5173  	} else if vt := u.OfTextEditorCodeExecutionToolResult; vt != nil {
  5174  		res.any = vt.Content.asAny()
  5175  	} else if vt := u.OfToolSearchToolResult; vt != nil {
  5176  		res.any = vt.Content.asAny()
  5177  	} else if vt := u.OfMCPToolResult; vt != nil {
  5178  		res.any = vt.Content.asAny()
  5179  	} else if vt := u.OfCompaction; vt != nil && vt.Content.Valid() {
  5180  		res.any = &vt.Content.Value
  5181  	}
  5182  	return
  5183  }
  5184  
  5185  // Can have the runtime types [_[]BetaTextBlockParam],
  5186  // [_[]BetaToolResultBlockParamContentUnion], [*[]BetaWebSearchResultBlockParam],
  5187  // [*BetaWebFetchToolResultErrorBlockParam], [*BetaWebFetchBlockParam],
  5188  // [*BetaAdvisorToolResultErrorParam], [*BetaAdvisorResultBlockParam],
  5189  // [*BetaAdvisorRedactedResultBlockParam],
  5190  // [*BetaCodeExecutionToolResultErrorParam], [*BetaCodeExecutionResultBlockParam],
  5191  // [*BetaEncryptedCodeExecutionResultBlockParam],
  5192  // [*BetaBashCodeExecutionToolResultErrorParam],
  5193  // [*BetaBashCodeExecutionResultBlockParam],
  5194  // [*BetaTextEditorCodeExecutionToolResultErrorParam],
  5195  // [*BetaTextEditorCodeExecutionViewResultBlockParam],
  5196  // [*BetaTextEditorCodeExecutionCreateResultBlockParam],
  5197  // [*BetaTextEditorCodeExecutionStrReplaceResultBlockParam],
  5198  // [*BetaToolSearchToolResultErrorParam],
  5199  // [*BetaToolSearchToolSearchResultBlockParam], [*string]
  5200  type betaContentBlockParamUnionContent struct{ any }
  5201  
  5202  // Use the following switch statement to get the type of the union:
  5203  //
  5204  //	switch u.AsAny().(type) {
  5205  //	case *[]anthropic.BetaTextBlockParam:
  5206  //	case *[]anthropic.BetaToolResultBlockParamContentUnion:
  5207  //	case *[]anthropic.BetaWebSearchResultBlockParam:
  5208  //	case *anthropic.BetaWebFetchToolResultErrorBlockParam:
  5209  //	case *anthropic.BetaWebFetchBlockParam:
  5210  //	case *anthropic.BetaAdvisorToolResultErrorParam:
  5211  //	case *anthropic.BetaAdvisorResultBlockParam:
  5212  //	case *anthropic.BetaAdvisorRedactedResultBlockParam:
  5213  //	case *anthropic.BetaCodeExecutionToolResultErrorParam:
  5214  //	case *anthropic.BetaCodeExecutionResultBlockParam:
  5215  //	case *anthropic.BetaEncryptedCodeExecutionResultBlockParam:
  5216  //	case *anthropic.BetaBashCodeExecutionToolResultErrorParam:
  5217  //	case *anthropic.BetaBashCodeExecutionResultBlockParam:
  5218  //	case *anthropic.BetaTextEditorCodeExecutionToolResultErrorParam:
  5219  //	case *anthropic.BetaTextEditorCodeExecutionViewResultBlockParam:
  5220  //	case *anthropic.BetaTextEditorCodeExecutionCreateResultBlockParam:
  5221  //	case *anthropic.BetaTextEditorCodeExecutionStrReplaceResultBlockParam:
  5222  //	case *anthropic.BetaToolSearchToolResultErrorParam:
  5223  //	case *anthropic.BetaToolSearchToolSearchResultBlockParam:
  5224  //	case *string:
  5225  //	default:
  5226  //	    fmt.Errorf("not present")
  5227  //	}
  5228  func (u betaContentBlockParamUnionContent) AsAny() any { return u.any }
  5229  
  5230  // Returns a pointer to the underlying variant's property, if present.
  5231  func (u betaContentBlockParamUnionContent) GetURL() *string {
  5232  	switch vt := u.any.(type) {
  5233  	case *BetaWebFetchToolResultBlockParamContentUnion:
  5234  		return vt.GetURL()
  5235  	}
  5236  	return nil
  5237  }
  5238  
  5239  // Returns a pointer to the underlying variant's property, if present.
  5240  func (u betaContentBlockParamUnionContent) GetRetrievedAt() *string {
  5241  	switch vt := u.any.(type) {
  5242  	case *BetaWebFetchToolResultBlockParamContentUnion:
  5243  		return vt.GetRetrievedAt()
  5244  	}
  5245  	return nil
  5246  }
  5247  
  5248  // Returns a pointer to the underlying variant's property, if present.
  5249  func (u betaContentBlockParamUnionContent) GetText() *string {
  5250  	switch vt := u.any.(type) {
  5251  	case *BetaAdvisorToolResultBlockParamContentUnion:
  5252  		return vt.GetText()
  5253  	}
  5254  	return nil
  5255  }
  5256  
  5257  // Returns a pointer to the underlying variant's property, if present.
  5258  func (u betaContentBlockParamUnionContent) GetEncryptedContent() *string {
  5259  	switch vt := u.any.(type) {
  5260  	case *BetaAdvisorToolResultBlockParamContentUnion:
  5261  		return vt.GetEncryptedContent()
  5262  	}
  5263  	return nil
  5264  }
  5265  
  5266  // Returns a pointer to the underlying variant's property, if present.
  5267  func (u betaContentBlockParamUnionContent) GetEncryptedStdout() *string {
  5268  	switch vt := u.any.(type) {
  5269  	case *BetaCodeExecutionToolResultBlockParamContentUnion:
  5270  		return vt.GetEncryptedStdout()
  5271  	}
  5272  	return nil
  5273  }
  5274  
  5275  // Returns a pointer to the underlying variant's property, if present.
  5276  func (u betaContentBlockParamUnionContent) GetFileType() *string {
  5277  	switch vt := u.any.(type) {
  5278  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5279  		return vt.GetFileType()
  5280  	}
  5281  	return nil
  5282  }
  5283  
  5284  // Returns a pointer to the underlying variant's property, if present.
  5285  func (u betaContentBlockParamUnionContent) GetNumLines() *int64 {
  5286  	switch vt := u.any.(type) {
  5287  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5288  		return vt.GetNumLines()
  5289  	}
  5290  	return nil
  5291  }
  5292  
  5293  // Returns a pointer to the underlying variant's property, if present.
  5294  func (u betaContentBlockParamUnionContent) GetStartLine() *int64 {
  5295  	switch vt := u.any.(type) {
  5296  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5297  		return vt.GetStartLine()
  5298  	}
  5299  	return nil
  5300  }
  5301  
  5302  // Returns a pointer to the underlying variant's property, if present.
  5303  func (u betaContentBlockParamUnionContent) GetTotalLines() *int64 {
  5304  	switch vt := u.any.(type) {
  5305  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5306  		return vt.GetTotalLines()
  5307  	}
  5308  	return nil
  5309  }
  5310  
  5311  // Returns a pointer to the underlying variant's property, if present.
  5312  func (u betaContentBlockParamUnionContent) GetIsFileUpdate() *bool {
  5313  	switch vt := u.any.(type) {
  5314  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5315  		return vt.GetIsFileUpdate()
  5316  	}
  5317  	return nil
  5318  }
  5319  
  5320  // Returns a pointer to the underlying variant's property, if present.
  5321  func (u betaContentBlockParamUnionContent) GetLines() []string {
  5322  	switch vt := u.any.(type) {
  5323  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5324  		return vt.GetLines()
  5325  	}
  5326  	return nil
  5327  }
  5328  
  5329  // Returns a pointer to the underlying variant's property, if present.
  5330  func (u betaContentBlockParamUnionContent) GetNewLines() *int64 {
  5331  	switch vt := u.any.(type) {
  5332  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5333  		return vt.GetNewLines()
  5334  	}
  5335  	return nil
  5336  }
  5337  
  5338  // Returns a pointer to the underlying variant's property, if present.
  5339  func (u betaContentBlockParamUnionContent) GetNewStart() *int64 {
  5340  	switch vt := u.any.(type) {
  5341  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5342  		return vt.GetNewStart()
  5343  	}
  5344  	return nil
  5345  }
  5346  
  5347  // Returns a pointer to the underlying variant's property, if present.
  5348  func (u betaContentBlockParamUnionContent) GetOldLines() *int64 {
  5349  	switch vt := u.any.(type) {
  5350  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5351  		return vt.GetOldLines()
  5352  	}
  5353  	return nil
  5354  }
  5355  
  5356  // Returns a pointer to the underlying variant's property, if present.
  5357  func (u betaContentBlockParamUnionContent) GetOldStart() *int64 {
  5358  	switch vt := u.any.(type) {
  5359  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5360  		return vt.GetOldStart()
  5361  	}
  5362  	return nil
  5363  }
  5364  
  5365  // Returns a pointer to the underlying variant's property, if present.
  5366  func (u betaContentBlockParamUnionContent) GetToolReferences() []BetaToolReferenceBlockParam {
  5367  	switch vt := u.any.(type) {
  5368  	case *BetaToolSearchToolResultBlockParamContentUnion:
  5369  		return vt.GetToolReferences()
  5370  	}
  5371  	return nil
  5372  }
  5373  
  5374  // Returns a pointer to the underlying variant's property, if present.
  5375  func (u betaContentBlockParamUnionContent) GetErrorCode() *string {
  5376  	switch vt := u.any.(type) {
  5377  	case *BetaWebSearchToolResultBlockParamContentUnion:
  5378  		if vt.OfError != nil {
  5379  			return (*string)(&vt.OfError.ErrorCode)
  5380  		}
  5381  	case *BetaWebFetchToolResultBlockParamContentUnion:
  5382  		return vt.GetErrorCode()
  5383  	case *BetaAdvisorToolResultBlockParamContentUnion:
  5384  		return vt.GetErrorCode()
  5385  	case *BetaCodeExecutionToolResultBlockParamContentUnion:
  5386  		return vt.GetErrorCode()
  5387  	case *BetaBashCodeExecutionToolResultBlockParamContentUnion:
  5388  		return vt.GetErrorCode()
  5389  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5390  		return vt.GetErrorCode()
  5391  	case *BetaToolSearchToolResultBlockParamContentUnion:
  5392  		return vt.GetErrorCode()
  5393  	}
  5394  	return nil
  5395  }
  5396  
  5397  // Returns a pointer to the underlying variant's property, if present.
  5398  func (u betaContentBlockParamUnionContent) GetType() *string {
  5399  	switch vt := u.any.(type) {
  5400  	case *BetaWebSearchToolResultBlockParamContentUnion:
  5401  		if vt.OfError != nil {
  5402  			return (*string)(&vt.OfError.Type)
  5403  		}
  5404  	case *BetaWebFetchToolResultBlockParamContentUnion:
  5405  		return vt.GetType()
  5406  	case *BetaAdvisorToolResultBlockParamContentUnion:
  5407  		return vt.GetType()
  5408  	case *BetaCodeExecutionToolResultBlockParamContentUnion:
  5409  		return vt.GetType()
  5410  	case *BetaBashCodeExecutionToolResultBlockParamContentUnion:
  5411  		return vt.GetType()
  5412  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5413  		return vt.GetType()
  5414  	case *BetaToolSearchToolResultBlockParamContentUnion:
  5415  		return vt.GetType()
  5416  	}
  5417  	return nil
  5418  }
  5419  
  5420  // Returns a pointer to the underlying variant's property, if present.
  5421  func (u betaContentBlockParamUnionContent) GetStopReason() *string {
  5422  	switch vt := u.any.(type) {
  5423  	case *BetaAdvisorToolResultBlockParamContentUnion:
  5424  		return vt.GetStopReason()
  5425  	}
  5426  	return nil
  5427  }
  5428  
  5429  // Returns a pointer to the underlying variant's property, if present.
  5430  func (u betaContentBlockParamUnionContent) GetReturnCode() *int64 {
  5431  	switch vt := u.any.(type) {
  5432  	case *BetaCodeExecutionToolResultBlockParamContentUnion:
  5433  		return vt.GetReturnCode()
  5434  	case *BetaBashCodeExecutionToolResultBlockParamContentUnion:
  5435  		return vt.GetReturnCode()
  5436  	}
  5437  	return nil
  5438  }
  5439  
  5440  // Returns a pointer to the underlying variant's property, if present.
  5441  func (u betaContentBlockParamUnionContent) GetStderr() *string {
  5442  	switch vt := u.any.(type) {
  5443  	case *BetaCodeExecutionToolResultBlockParamContentUnion:
  5444  		return vt.GetStderr()
  5445  	case *BetaBashCodeExecutionToolResultBlockParamContentUnion:
  5446  		return vt.GetStderr()
  5447  	}
  5448  	return nil
  5449  }
  5450  
  5451  // Returns a pointer to the underlying variant's property, if present.
  5452  func (u betaContentBlockParamUnionContent) GetStdout() *string {
  5453  	switch vt := u.any.(type) {
  5454  	case *BetaCodeExecutionToolResultBlockParamContentUnion:
  5455  		return vt.GetStdout()
  5456  	case *BetaBashCodeExecutionToolResultBlockParamContentUnion:
  5457  		return vt.GetStdout()
  5458  	}
  5459  	return nil
  5460  }
  5461  
  5462  // Returns a pointer to the underlying variant's property, if present.
  5463  func (u betaContentBlockParamUnionContent) GetErrorMessage() *string {
  5464  	switch vt := u.any.(type) {
  5465  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5466  		return vt.GetErrorMessage()
  5467  	case *BetaToolSearchToolResultBlockParamContentUnion:
  5468  		return vt.GetErrorMessage()
  5469  	}
  5470  	return nil
  5471  }
  5472  
  5473  // Returns a subunion which exports methods to access subproperties
  5474  //
  5475  // Or use AsAny() to get the underlying value
  5476  func (u betaContentBlockParamUnionContent) GetContent() (res betaContentBlockParamUnionContentContent) {
  5477  	switch vt := u.any.(type) {
  5478  	case *BetaWebFetchToolResultBlockParamContentUnion:
  5479  		res.any = vt.GetContent()
  5480  	case *BetaCodeExecutionToolResultBlockParamContentUnion:
  5481  		res.any = vt.GetContent()
  5482  	case *BetaBashCodeExecutionToolResultBlockParamContentUnion:
  5483  		res.any = vt.GetContent()
  5484  	case *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion:
  5485  		res.any = vt.GetContent()
  5486  	}
  5487  	return res
  5488  }
  5489  
  5490  // Can have the runtime types [*BetaRequestDocumentBlockParam],
  5491  // [_[]BetaCodeExecutionOutputBlockParam],
  5492  // [_[]BetaBashCodeExecutionOutputBlockParam], [*string]
  5493  type betaContentBlockParamUnionContentContent struct{ any }
  5494  
  5495  // Use the following switch statement to get the type of the union:
  5496  //
  5497  //	switch u.AsAny().(type) {
  5498  //	case *anthropic.BetaRequestDocumentBlockParam:
  5499  //	case *[]anthropic.BetaCodeExecutionOutputBlockParam:
  5500  //	case *[]anthropic.BetaBashCodeExecutionOutputBlockParam:
  5501  //	case *string:
  5502  //	default:
  5503  //	    fmt.Errorf("not present")
  5504  //	}
  5505  func (u betaContentBlockParamUnionContentContent) AsAny() any { return u.any }
  5506  
  5507  // Returns a pointer to the underlying variant's Input property, if present.
  5508  func (u BetaContentBlockParamUnion) GetInput() *any {
  5509  	if vt := u.OfToolUse; vt != nil {
  5510  		return &vt.Input
  5511  	} else if vt := u.OfServerToolUse; vt != nil {
  5512  		return &vt.Input
  5513  	} else if vt := u.OfMCPToolUse; vt != nil {
  5514  		return &vt.Input
  5515  	}
  5516  	return nil
  5517  }
  5518  
  5519  // Returns a subunion which exports methods to access subproperties
  5520  //
  5521  // Or use AsAny() to get the underlying value
  5522  func (u BetaContentBlockParamUnion) GetCaller() (res betaContentBlockParamUnionCaller) {
  5523  	if vt := u.OfToolUse; vt != nil {
  5524  		res.any = vt.Caller.asAny()
  5525  	} else if vt := u.OfServerToolUse; vt != nil {
  5526  		res.any = vt.Caller.asAny()
  5527  	} else if vt := u.OfWebSearchToolResult; vt != nil {
  5528  		res.any = vt.Caller.asAny()
  5529  	} else if vt := u.OfWebFetchToolResult; vt != nil {
  5530  		res.any = vt.Caller.asAny()
  5531  	}
  5532  	return
  5533  }
  5534  
  5535  // Can have the runtime types [*BetaDirectCallerParam],
  5536  // [*BetaServerToolCallerParam], [*BetaServerToolCaller20260120Param]
  5537  type betaContentBlockParamUnionCaller struct{ any }
  5538  
  5539  // Use the following switch statement to get the type of the union:
  5540  //
  5541  //	switch u.AsAny().(type) {
  5542  //	case *anthropic.BetaDirectCallerParam:
  5543  //	case *anthropic.BetaServerToolCallerParam:
  5544  //	case *anthropic.BetaServerToolCaller20260120Param:
  5545  //	default:
  5546  //	    fmt.Errorf("not present")
  5547  //	}
  5548  func (u betaContentBlockParamUnionCaller) AsAny() any { return u.any }
  5549  
  5550  // Returns a pointer to the underlying variant's property, if present.
  5551  func (u betaContentBlockParamUnionCaller) GetType() *string {
  5552  	switch vt := u.any.(type) {
  5553  	case *BetaToolUseBlockParamCallerUnion:
  5554  		return vt.GetType()
  5555  	case *BetaServerToolUseBlockParamCallerUnion:
  5556  		return vt.GetType()
  5557  	case *BetaWebSearchToolResultBlockParamCallerUnion:
  5558  		return vt.GetType()
  5559  	case *BetaWebFetchToolResultBlockParamCallerUnion:
  5560  		return vt.GetType()
  5561  	}
  5562  	return nil
  5563  }
  5564  
  5565  // Returns a pointer to the underlying variant's property, if present.
  5566  func (u betaContentBlockParamUnionCaller) GetToolID() *string {
  5567  	switch vt := u.any.(type) {
  5568  	case *BetaToolUseBlockParamCallerUnion:
  5569  		return vt.GetToolID()
  5570  	case *BetaServerToolUseBlockParamCallerUnion:
  5571  		return vt.GetToolID()
  5572  	case *BetaWebSearchToolResultBlockParamCallerUnion:
  5573  		return vt.GetToolID()
  5574  	case *BetaWebFetchToolResultBlockParamCallerUnion:
  5575  		return vt.GetToolID()
  5576  	}
  5577  	return nil
  5578  }
  5579  
  5580  // Returns a subunion which exports methods to access subproperties
  5581  //
  5582  // Or use AsAny() to get the underlying value
  5583  func (u BetaContentBlockParamUnion) GetTool() (res betaContentBlockParamUnionTool) {
  5584  	if vt := u.OfToolAddition; vt != nil {
  5585  		res.any = vt.Tool.asAny()
  5586  	} else if vt := u.OfToolRemoval; vt != nil {
  5587  		res.any = vt.Tool.asAny()
  5588  	}
  5589  	return
  5590  }
  5591  
  5592  // Can have the runtime types [*BetaToolChangeToolReferenceParam],
  5593  // [*BetaToolChangeMCPToolReferenceParam],
  5594  // [*BetaToolChangeMCPToolsetReferenceParam]
  5595  type betaContentBlockParamUnionTool struct{ any }
  5596  
  5597  // Use the following switch statement to get the type of the union:
  5598  //
  5599  //	switch u.AsAny().(type) {
  5600  //	case *anthropic.BetaToolChangeToolReferenceParam:
  5601  //	case *anthropic.BetaToolChangeMCPToolReferenceParam:
  5602  //	case *anthropic.BetaToolChangeMCPToolsetReferenceParam:
  5603  //	default:
  5604  //	    fmt.Errorf("not present")
  5605  //	}
  5606  func (u betaContentBlockParamUnionTool) AsAny() any { return u.any }
  5607  
  5608  // Returns a pointer to the underlying variant's property, if present.
  5609  func (u betaContentBlockParamUnionTool) GetName() *string {
  5610  	switch vt := u.any.(type) {
  5611  	case *BetaRequestToolAdditionBlockToolUnionParam:
  5612  		return vt.GetName()
  5613  	case *BetaRequestToolRemovalBlockToolUnionParam:
  5614  		return vt.GetName()
  5615  	}
  5616  	return nil
  5617  }
  5618  
  5619  // Returns a pointer to the underlying variant's property, if present.
  5620  func (u betaContentBlockParamUnionTool) GetType() *string {
  5621  	switch vt := u.any.(type) {
  5622  	case *BetaRequestToolAdditionBlockToolUnionParam:
  5623  		return vt.GetType()
  5624  	case *BetaRequestToolRemovalBlockToolUnionParam:
  5625  		return vt.GetType()
  5626  	}
  5627  	return nil
  5628  }
  5629  
  5630  // Returns a pointer to the underlying variant's property, if present.
  5631  func (u betaContentBlockParamUnionTool) GetServerName() *string {
  5632  	switch vt := u.any.(type) {
  5633  	case *BetaRequestToolAdditionBlockToolUnionParam:
  5634  		return vt.GetServerName()
  5635  	case *BetaRequestToolRemovalBlockToolUnionParam:
  5636  		return vt.GetServerName()
  5637  	}
  5638  	return nil
  5639  }
  5640  
  5641  func init() {
  5642  	apijson.RegisterUnion[BetaContentBlockParamUnion](
  5643  		"type",
  5644  		apijson.Discriminator[BetaTextBlockParam]("text"),
  5645  		apijson.Discriminator[BetaImageBlockParam]("image"),
  5646  		apijson.Discriminator[BetaRequestDocumentBlockParam]("document"),
  5647  		apijson.Discriminator[BetaSearchResultBlockParam]("search_result"),
  5648  		apijson.Discriminator[BetaThinkingBlockParam]("thinking"),
  5649  		apijson.Discriminator[BetaRedactedThinkingBlockParam]("redacted_thinking"),
  5650  		apijson.Discriminator[BetaToolUseBlockParam]("tool_use"),
  5651  		apijson.Discriminator[BetaToolResultBlockParam]("tool_result"),
  5652  		apijson.Discriminator[BetaServerToolUseBlockParam]("server_tool_use"),
  5653  		apijson.Discriminator[BetaWebSearchToolResultBlockParam]("web_search_tool_result"),
  5654  		apijson.Discriminator[BetaWebFetchToolResultBlockParam]("web_fetch_tool_result"),
  5655  		apijson.Discriminator[BetaAdvisorToolResultBlockParam]("advisor_tool_result"),
  5656  		apijson.Discriminator[BetaCodeExecutionToolResultBlockParam]("code_execution_tool_result"),
  5657  		apijson.Discriminator[BetaBashCodeExecutionToolResultBlockParam]("bash_code_execution_tool_result"),
  5658  		apijson.Discriminator[BetaTextEditorCodeExecutionToolResultBlockParam]("text_editor_code_execution_tool_result"),
  5659  		apijson.Discriminator[BetaToolSearchToolResultBlockParam]("tool_search_tool_result"),
  5660  		apijson.Discriminator[BetaMCPToolUseBlockParam]("mcp_tool_use"),
  5661  		apijson.Discriminator[BetaRequestMCPToolResultBlockParam]("mcp_tool_result"),
  5662  		apijson.Discriminator[BetaContainerUploadBlockParam]("container_upload"),
  5663  		apijson.Discriminator[BetaCompactionBlockParam]("compaction"),
  5664  		apijson.Discriminator[BetaRequestToolAdditionBlockParam]("tool_addition"),
  5665  		apijson.Discriminator[BetaRequestToolRemovalBlockParam]("tool_removal"),
  5666  		apijson.Discriminator[BetaFallbackBlockParam]("fallback"),
  5667  	)
  5668  }
  5669  
  5670  // The properties Content, Type are required.
  5671  type BetaContentBlockSourceParam struct {
  5672  	Content BetaContentBlockSourceContentUnionParam `json:"content,omitzero" api:"required"`
  5673  	// This field can be elided, and will marshal its zero value as "content".
  5674  	Type constant.Content `json:"type" default:"content"`
  5675  	paramObj
  5676  }
  5677  
  5678  func (r BetaContentBlockSourceParam) MarshalJSON() (data []byte, err error) {
  5679  	type shadow BetaContentBlockSourceParam
  5680  	return param.MarshalObject(r, (*shadow)(&r))
  5681  }
  5682  func (r *BetaContentBlockSourceParam) UnmarshalJSON(data []byte) error {
  5683  	return apijson.UnmarshalRoot(data, r)
  5684  }
  5685  
  5686  // Only one field can be non-zero.
  5687  //
  5688  // Use [param.IsOmitted] to confirm if a field is set.
  5689  type BetaContentBlockSourceContentUnionParam struct {
  5690  	OfString                        param.Opt[string]                         `json:",omitzero,inline"`
  5691  	OfBetaContentBlockSourceContent []BetaContentBlockSourceContentUnionParam `json:",omitzero,inline"`
  5692  	paramUnion
  5693  }
  5694  
  5695  func (u BetaContentBlockSourceContentUnionParam) MarshalJSON() ([]byte, error) {
  5696  	return param.MarshalUnion(u, u.OfString, u.OfBetaContentBlockSourceContent)
  5697  }
  5698  func (u *BetaContentBlockSourceContentUnionParam) UnmarshalJSON(data []byte) error {
  5699  	return apijson.UnmarshalRoot(data, u)
  5700  }
  5701  
  5702  func (u *BetaContentBlockSourceContentUnionParam) asAny() any {
  5703  	if !param.IsOmitted(u.OfString) {
  5704  		return &u.OfString.Value
  5705  	} else if !param.IsOmitted(u.OfBetaContentBlockSourceContent) {
  5706  		return &u.OfBetaContentBlockSourceContent
  5707  	}
  5708  	return nil
  5709  }
  5710  
  5711  type BetaContextManagementConfigParam struct {
  5712  	// List of context management edits to apply
  5713  	Edits []BetaContextManagementConfigEditUnionParam `json:"edits,omitzero"`
  5714  	paramObj
  5715  }
  5716  
  5717  func (r BetaContextManagementConfigParam) MarshalJSON() (data []byte, err error) {
  5718  	type shadow BetaContextManagementConfigParam
  5719  	return param.MarshalObject(r, (*shadow)(&r))
  5720  }
  5721  func (r *BetaContextManagementConfigParam) UnmarshalJSON(data []byte) error {
  5722  	return apijson.UnmarshalRoot(data, r)
  5723  }
  5724  
  5725  // Only one field can be non-zero.
  5726  //
  5727  // Use [param.IsOmitted] to confirm if a field is set.
  5728  type BetaContextManagementConfigEditUnionParam struct {
  5729  	OfClearToolUses20250919 *BetaClearToolUses20250919EditParam `json:",omitzero,inline"`
  5730  	OfClearThinking20251015 *BetaClearThinking20251015EditParam `json:",omitzero,inline"`
  5731  	OfCompact20260112       *BetaCompact20260112EditParam       `json:",omitzero,inline"`
  5732  	paramUnion
  5733  }
  5734  
  5735  func (u BetaContextManagementConfigEditUnionParam) MarshalJSON() ([]byte, error) {
  5736  	return param.MarshalUnion(u, u.OfClearToolUses20250919, u.OfClearThinking20251015, u.OfCompact20260112)
  5737  }
  5738  func (u *BetaContextManagementConfigEditUnionParam) UnmarshalJSON(data []byte) error {
  5739  	return apijson.UnmarshalRoot(data, u)
  5740  }
  5741  
  5742  func (u *BetaContextManagementConfigEditUnionParam) asAny() any {
  5743  	if !param.IsOmitted(u.OfClearToolUses20250919) {
  5744  		return u.OfClearToolUses20250919
  5745  	} else if !param.IsOmitted(u.OfClearThinking20251015) {
  5746  		return u.OfClearThinking20251015
  5747  	} else if !param.IsOmitted(u.OfCompact20260112) {
  5748  		return u.OfCompact20260112
  5749  	}
  5750  	return nil
  5751  }
  5752  
  5753  // Returns a pointer to the underlying variant's property, if present.
  5754  func (u BetaContextManagementConfigEditUnionParam) GetClearAtLeast() *BetaInputTokensClearAtLeastParam {
  5755  	if vt := u.OfClearToolUses20250919; vt != nil {
  5756  		return &vt.ClearAtLeast
  5757  	}
  5758  	return nil
  5759  }
  5760  
  5761  // Returns a pointer to the underlying variant's property, if present.
  5762  func (u BetaContextManagementConfigEditUnionParam) GetClearToolInputs() *BetaClearToolUses20250919EditClearToolInputsUnionParam {
  5763  	if vt := u.OfClearToolUses20250919; vt != nil {
  5764  		return &vt.ClearToolInputs
  5765  	}
  5766  	return nil
  5767  }
  5768  
  5769  // Returns a pointer to the underlying variant's property, if present.
  5770  func (u BetaContextManagementConfigEditUnionParam) GetExcludeTools() []string {
  5771  	if vt := u.OfClearToolUses20250919; vt != nil {
  5772  		return vt.ExcludeTools
  5773  	}
  5774  	return nil
  5775  }
  5776  
  5777  // Returns a pointer to the underlying variant's property, if present.
  5778  func (u BetaContextManagementConfigEditUnionParam) GetInstructions() *string {
  5779  	if vt := u.OfCompact20260112; vt != nil && vt.Instructions.Valid() {
  5780  		return &vt.Instructions.Value
  5781  	}
  5782  	return nil
  5783  }
  5784  
  5785  // Returns a pointer to the underlying variant's property, if present.
  5786  func (u BetaContextManagementConfigEditUnionParam) GetPauseAfterCompaction() *bool {
  5787  	if vt := u.OfCompact20260112; vt != nil && vt.PauseAfterCompaction.Valid() {
  5788  		return &vt.PauseAfterCompaction.Value
  5789  	}
  5790  	return nil
  5791  }
  5792  
  5793  // Returns a pointer to the underlying variant's property, if present.
  5794  func (u BetaContextManagementConfigEditUnionParam) GetType() *string {
  5795  	if vt := u.OfClearToolUses20250919; vt != nil {
  5796  		return (*string)(&vt.Type)
  5797  	} else if vt := u.OfClearThinking20251015; vt != nil {
  5798  		return (*string)(&vt.Type)
  5799  	} else if vt := u.OfCompact20260112; vt != nil {
  5800  		return (*string)(&vt.Type)
  5801  	}
  5802  	return nil
  5803  }
  5804  
  5805  // Returns a subunion which exports methods to access subproperties
  5806  //
  5807  // Or use AsAny() to get the underlying value
  5808  func (u BetaContextManagementConfigEditUnionParam) GetKeep() (res betaContextManagementConfigEditUnionParamKeep) {
  5809  	if vt := u.OfClearToolUses20250919; vt != nil {
  5810  		res.any = &vt.Keep
  5811  	} else if vt := u.OfClearThinking20251015; vt != nil {
  5812  		res.any = vt.Keep.asAny()
  5813  	}
  5814  	return
  5815  }
  5816  
  5817  // Can have the runtime types [*BetaToolUsesKeepParam], [*string]
  5818  type betaContextManagementConfigEditUnionParamKeep struct{ any }
  5819  
  5820  // Use the following switch statement to get the type of the union:
  5821  //
  5822  //	switch u.AsAny().(type) {
  5823  //	case *anthropic.BetaToolUsesKeepParam:
  5824  //	case *string:
  5825  //	default:
  5826  //	    fmt.Errorf("not present")
  5827  //	}
  5828  func (u betaContextManagementConfigEditUnionParamKeep) AsAny() any { return u.any }
  5829  
  5830  // Returns a pointer to the underlying variant's property, if present.
  5831  func (u betaContextManagementConfigEditUnionParamKeep) GetType() *string {
  5832  	switch vt := u.any.(type) {
  5833  	case *BetaToolUsesKeepParam:
  5834  		return (*string)(&vt.Type)
  5835  	case *BetaClearThinking20251015EditKeepUnionParam:
  5836  		return vt.GetType()
  5837  	}
  5838  	return nil
  5839  }
  5840  
  5841  // Returns a pointer to the underlying variant's property, if present.
  5842  func (u betaContextManagementConfigEditUnionParamKeep) GetValue() *int64 {
  5843  	switch vt := u.any.(type) {
  5844  	case *BetaToolUsesKeepParam:
  5845  		return (*int64)(&vt.Value)
  5846  	case *BetaClearThinking20251015EditKeepUnionParam:
  5847  		return vt.GetValue()
  5848  	}
  5849  	return nil
  5850  }
  5851  
  5852  func init() {
  5853  	apijson.RegisterUnion[BetaContextManagementConfigEditUnionParam](
  5854  		"type",
  5855  		apijson.Discriminator[BetaClearToolUses20250919EditParam]("clear_tool_uses_20250919"),
  5856  		apijson.Discriminator[BetaClearThinking20251015EditParam]("clear_thinking_20251015"),
  5857  		apijson.Discriminator[BetaCompact20260112EditParam]("compact_20260112"),
  5858  	)
  5859  }
  5860  
  5861  type BetaContextManagementResponse struct {
  5862  	// List of context management edits that were applied.
  5863  	AppliedEdits []BetaContextManagementResponseAppliedEditUnion `json:"applied_edits" api:"required"`
  5864  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  5865  	JSON struct {
  5866  		AppliedEdits respjson.Field
  5867  		ExtraFields  map[string]respjson.Field
  5868  		raw          string
  5869  	} `json:"-"`
  5870  }
  5871  
  5872  // Returns the unmodified JSON received from the API
  5873  func (r BetaContextManagementResponse) RawJSON() string { return r.JSON.raw }
  5874  func (r *BetaContextManagementResponse) UnmarshalJSON(data []byte) error {
  5875  	return apijson.UnmarshalRoot(data, r)
  5876  }
  5877  
  5878  // BetaContextManagementResponseAppliedEditUnion contains all possible properties
  5879  // and values from [BetaClearToolUses20250919EditResponse],
  5880  // [BetaClearThinking20251015EditResponse].
  5881  //
  5882  // Use the [BetaContextManagementResponseAppliedEditUnion.AsAny] method to switch
  5883  // on the variant.
  5884  //
  5885  // Use the methods beginning with 'As' to cast the union to one of its variants.
  5886  type BetaContextManagementResponseAppliedEditUnion struct {
  5887  	ClearedInputTokens int64 `json:"cleared_input_tokens"`
  5888  	// This field is from variant [BetaClearToolUses20250919EditResponse].
  5889  	ClearedToolUses int64 `json:"cleared_tool_uses"`
  5890  	// Any of "clear_tool_uses_20250919", "clear_thinking_20251015".
  5891  	Type string `json:"type"`
  5892  	// This field is from variant [BetaClearThinking20251015EditResponse].
  5893  	ClearedThinkingTurns int64 `json:"cleared_thinking_turns"`
  5894  	JSON                 struct {
  5895  		ClearedInputTokens   respjson.Field
  5896  		ClearedToolUses      respjson.Field
  5897  		Type                 respjson.Field
  5898  		ClearedThinkingTurns respjson.Field
  5899  		raw                  string
  5900  	} `json:"-"`
  5901  }
  5902  
  5903  // anyBetaContextManagementResponseAppliedEdit is implemented by each variant of
  5904  // [BetaContextManagementResponseAppliedEditUnion] to add type safety for the
  5905  // return type of [BetaContextManagementResponseAppliedEditUnion.AsAny]
  5906  type anyBetaContextManagementResponseAppliedEdit interface {
  5907  	implBetaContextManagementResponseAppliedEditUnion()
  5908  }
  5909  
  5910  func (BetaClearToolUses20250919EditResponse) implBetaContextManagementResponseAppliedEditUnion() {}
  5911  func (BetaClearThinking20251015EditResponse) implBetaContextManagementResponseAppliedEditUnion() {}
  5912  
  5913  // Use the following switch statement to find the correct variant
  5914  //
  5915  //	switch variant := BetaContextManagementResponseAppliedEditUnion.AsAny().(type) {
  5916  //	case anthropic.BetaClearToolUses20250919EditResponse:
  5917  //	case anthropic.BetaClearThinking20251015EditResponse:
  5918  //	default:
  5919  //	  fmt.Errorf("no variant present")
  5920  //	}
  5921  func (u BetaContextManagementResponseAppliedEditUnion) AsAny() anyBetaContextManagementResponseAppliedEdit {
  5922  	switch u.Type {
  5923  	case "clear_tool_uses_20250919":
  5924  		return u.AsClearToolUses20250919()
  5925  	case "clear_thinking_20251015":
  5926  		return u.AsClearThinking20251015()
  5927  	}
  5928  	return nil
  5929  }
  5930  
  5931  func (u BetaContextManagementResponseAppliedEditUnion) AsClearToolUses20250919() (v BetaClearToolUses20250919EditResponse) {
  5932  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  5933  	return
  5934  }
  5935  
  5936  func (u BetaContextManagementResponseAppliedEditUnion) AsClearThinking20251015() (v BetaClearThinking20251015EditResponse) {
  5937  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  5938  	return
  5939  }
  5940  
  5941  // Returns the unmodified JSON received from the API
  5942  func (u BetaContextManagementResponseAppliedEditUnion) RawJSON() string { return u.JSON.raw }
  5943  
  5944  func (r *BetaContextManagementResponseAppliedEditUnion) UnmarshalJSON(data []byte) error {
  5945  	return apijson.UnmarshalRoot(data, r)
  5946  }
  5947  
  5948  type BetaCountTokensContextManagementResponse struct {
  5949  	// The original token count before context management was applied
  5950  	OriginalInputTokens int64 `json:"original_input_tokens" api:"required"`
  5951  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  5952  	JSON struct {
  5953  		OriginalInputTokens respjson.Field
  5954  		ExtraFields         map[string]respjson.Field
  5955  		raw                 string
  5956  	} `json:"-"`
  5957  }
  5958  
  5959  // Returns the unmodified JSON received from the API
  5960  func (r BetaCountTokensContextManagementResponse) RawJSON() string { return r.JSON.raw }
  5961  func (r *BetaCountTokensContextManagementResponse) UnmarshalJSON(data []byte) error {
  5962  	return apijson.UnmarshalRoot(data, r)
  5963  }
  5964  
  5965  // Response envelope for request-level diagnostics. Present (possibly null)
  5966  // whenever the caller supplied `diagnostics` on the request.
  5967  type BetaDiagnostics struct {
  5968  	// Explains why the prompt cache could not fully reuse the prefix from the request
  5969  	// identified by `diagnostics.previous_message_id`. `null` means diagnosis is still
  5970  	// pending — the response was serialized before the background comparison
  5971  	// completed.
  5972  	CacheMissReason BetaDiagnosticsCacheMissReasonUnion `json:"cache_miss_reason" api:"required"`
  5973  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  5974  	JSON struct {
  5975  		CacheMissReason respjson.Field
  5976  		ExtraFields     map[string]respjson.Field
  5977  		raw             string
  5978  	} `json:"-"`
  5979  }
  5980  
  5981  // Returns the unmodified JSON received from the API
  5982  func (r BetaDiagnostics) RawJSON() string { return r.JSON.raw }
  5983  func (r *BetaDiagnostics) UnmarshalJSON(data []byte) error {
  5984  	return apijson.UnmarshalRoot(data, r)
  5985  }
  5986  
  5987  // BetaDiagnosticsCacheMissReasonUnion contains all possible properties and values
  5988  // from [BetaCacheMissModelChanged], [BetaCacheMissSystemChanged],
  5989  // [BetaCacheMissToolsChanged], [BetaCacheMissMessagesChanged],
  5990  // [BetaCacheMissPreviousMessageNotFound], [BetaCacheMissUnavailable].
  5991  //
  5992  // Use the [BetaDiagnosticsCacheMissReasonUnion.AsAny] method to switch on the
  5993  // variant.
  5994  //
  5995  // Use the methods beginning with 'As' to cast the union to one of its variants.
  5996  type BetaDiagnosticsCacheMissReasonUnion struct {
  5997  	CacheMissedInputTokens int64 `json:"cache_missed_input_tokens"`
  5998  	// Any of "model_changed", "system_changed", "tools_changed", "messages_changed",
  5999  	// "previous_message_not_found", "unavailable".
  6000  	Type string `json:"type"`
  6001  	JSON struct {
  6002  		CacheMissedInputTokens respjson.Field
  6003  		Type                   respjson.Field
  6004  		raw                    string
  6005  	} `json:"-"`
  6006  }
  6007  
  6008  // anyBetaDiagnosticsCacheMissReason is implemented by each variant of
  6009  // [BetaDiagnosticsCacheMissReasonUnion] to add type safety for the return type of
  6010  // [BetaDiagnosticsCacheMissReasonUnion.AsAny]
  6011  type anyBetaDiagnosticsCacheMissReason interface {
  6012  	implBetaDiagnosticsCacheMissReasonUnion()
  6013  }
  6014  
  6015  func (BetaCacheMissModelChanged) implBetaDiagnosticsCacheMissReasonUnion()            {}
  6016  func (BetaCacheMissSystemChanged) implBetaDiagnosticsCacheMissReasonUnion()           {}
  6017  func (BetaCacheMissToolsChanged) implBetaDiagnosticsCacheMissReasonUnion()            {}
  6018  func (BetaCacheMissMessagesChanged) implBetaDiagnosticsCacheMissReasonUnion()         {}
  6019  func (BetaCacheMissPreviousMessageNotFound) implBetaDiagnosticsCacheMissReasonUnion() {}
  6020  func (BetaCacheMissUnavailable) implBetaDiagnosticsCacheMissReasonUnion()             {}
  6021  
  6022  // Use the following switch statement to find the correct variant
  6023  //
  6024  //	switch variant := BetaDiagnosticsCacheMissReasonUnion.AsAny().(type) {
  6025  //	case anthropic.BetaCacheMissModelChanged:
  6026  //	case anthropic.BetaCacheMissSystemChanged:
  6027  //	case anthropic.BetaCacheMissToolsChanged:
  6028  //	case anthropic.BetaCacheMissMessagesChanged:
  6029  //	case anthropic.BetaCacheMissPreviousMessageNotFound:
  6030  //	case anthropic.BetaCacheMissUnavailable:
  6031  //	default:
  6032  //	  fmt.Errorf("no variant present")
  6033  //	}
  6034  func (u BetaDiagnosticsCacheMissReasonUnion) AsAny() anyBetaDiagnosticsCacheMissReason {
  6035  	switch u.Type {
  6036  	case "model_changed":
  6037  		return u.AsModelChanged()
  6038  	case "system_changed":
  6039  		return u.AsSystemChanged()
  6040  	case "tools_changed":
  6041  		return u.AsToolsChanged()
  6042  	case "messages_changed":
  6043  		return u.AsMessagesChanged()
  6044  	case "previous_message_not_found":
  6045  		return u.AsPreviousMessageNotFound()
  6046  	case "unavailable":
  6047  		return u.AsUnavailable()
  6048  	}
  6049  	return nil
  6050  }
  6051  
  6052  func (u BetaDiagnosticsCacheMissReasonUnion) AsModelChanged() (v BetaCacheMissModelChanged) {
  6053  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6054  	return
  6055  }
  6056  
  6057  func (u BetaDiagnosticsCacheMissReasonUnion) AsSystemChanged() (v BetaCacheMissSystemChanged) {
  6058  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6059  	return
  6060  }
  6061  
  6062  func (u BetaDiagnosticsCacheMissReasonUnion) AsToolsChanged() (v BetaCacheMissToolsChanged) {
  6063  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6064  	return
  6065  }
  6066  
  6067  func (u BetaDiagnosticsCacheMissReasonUnion) AsMessagesChanged() (v BetaCacheMissMessagesChanged) {
  6068  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6069  	return
  6070  }
  6071  
  6072  func (u BetaDiagnosticsCacheMissReasonUnion) AsPreviousMessageNotFound() (v BetaCacheMissPreviousMessageNotFound) {
  6073  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6074  	return
  6075  }
  6076  
  6077  func (u BetaDiagnosticsCacheMissReasonUnion) AsUnavailable() (v BetaCacheMissUnavailable) {
  6078  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6079  	return
  6080  }
  6081  
  6082  // Returns the unmodified JSON received from the API
  6083  func (u BetaDiagnosticsCacheMissReasonUnion) RawJSON() string { return u.JSON.raw }
  6084  
  6085  func (r *BetaDiagnosticsCacheMissReasonUnion) UnmarshalJSON(data []byte) error {
  6086  	return apijson.UnmarshalRoot(data, r)
  6087  }
  6088  
  6089  // Request-level diagnostics. Currently carries the previous response id for
  6090  // prompt-cache divergence reporting.
  6091  type BetaDiagnosticsParam struct {
  6092  	// The `id` (`msg_...`) from this client's previous /v1/messages response. The
  6093  	// server compares that request's prompt fingerprint against this one and returns
  6094  	// `diagnostics.cache_miss_reason` when the prompt-cache prefix could not be
  6095  	// reused. Pass `null` on the first turn to opt in without a prior message to
  6096  	// compare.
  6097  	PreviousMessageID param.Opt[string] `json:"previous_message_id,omitzero"`
  6098  	paramObj
  6099  }
  6100  
  6101  func (r BetaDiagnosticsParam) MarshalJSON() (data []byte, err error) {
  6102  	type shadow BetaDiagnosticsParam
  6103  	return param.MarshalObject(r, (*shadow)(&r))
  6104  }
  6105  func (r *BetaDiagnosticsParam) UnmarshalJSON(data []byte) error {
  6106  	return apijson.UnmarshalRoot(data, r)
  6107  }
  6108  
  6109  // Tool invocation directly from the model.
  6110  type BetaDirectCaller struct {
  6111  	Type constant.Direct `json:"type" default:"direct"`
  6112  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6113  	JSON struct {
  6114  		Type        respjson.Field
  6115  		ExtraFields map[string]respjson.Field
  6116  		raw         string
  6117  	} `json:"-"`
  6118  }
  6119  
  6120  // Returns the unmodified JSON received from the API
  6121  func (r BetaDirectCaller) RawJSON() string { return r.JSON.raw }
  6122  func (r *BetaDirectCaller) UnmarshalJSON(data []byte) error {
  6123  	return apijson.UnmarshalRoot(data, r)
  6124  }
  6125  
  6126  // ToParam converts this BetaDirectCaller to a BetaDirectCallerParam.
  6127  //
  6128  // Warning: the fields of the param type will not be present. ToParam should only
  6129  // be used at the last possible moment before sending a request. Test for this with
  6130  // BetaDirectCallerParam.Overrides()
  6131  func (r BetaDirectCaller) ToParam() BetaDirectCallerParam {
  6132  	return param.Override[BetaDirectCallerParam](json.RawMessage(r.RawJSON()))
  6133  }
  6134  
  6135  func NewBetaDirectCallerParam() BetaDirectCallerParam {
  6136  	return BetaDirectCallerParam{
  6137  		Type: "direct",
  6138  	}
  6139  }
  6140  
  6141  // Tool invocation directly from the model.
  6142  //
  6143  // This struct has a constant value, construct it with [NewBetaDirectCallerParam].
  6144  type BetaDirectCallerParam struct {
  6145  	Type constant.Direct `json:"type" default:"direct"`
  6146  	paramObj
  6147  }
  6148  
  6149  func (r BetaDirectCallerParam) MarshalJSON() (data []byte, err error) {
  6150  	type shadow BetaDirectCallerParam
  6151  	return param.MarshalObject(r, (*shadow)(&r))
  6152  }
  6153  func (r *BetaDirectCallerParam) UnmarshalJSON(data []byte) error {
  6154  	return apijson.UnmarshalRoot(data, r)
  6155  }
  6156  
  6157  type BetaDocumentBlock struct {
  6158  	// Citation configuration for the document
  6159  	Citations BetaCitationConfig           `json:"citations" api:"required"`
  6160  	Source    BetaDocumentBlockSourceUnion `json:"source" api:"required"`
  6161  	// The title of the document
  6162  	Title string            `json:"title" api:"required"`
  6163  	Type  constant.Document `json:"type" default:"document"`
  6164  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6165  	JSON struct {
  6166  		Citations   respjson.Field
  6167  		Source      respjson.Field
  6168  		Title       respjson.Field
  6169  		Type        respjson.Field
  6170  		ExtraFields map[string]respjson.Field
  6171  		raw         string
  6172  	} `json:"-"`
  6173  }
  6174  
  6175  // Returns the unmodified JSON received from the API
  6176  func (r BetaDocumentBlock) RawJSON() string { return r.JSON.raw }
  6177  func (r *BetaDocumentBlock) UnmarshalJSON(data []byte) error {
  6178  	return apijson.UnmarshalRoot(data, r)
  6179  }
  6180  
  6181  // BetaDocumentBlockSourceUnion contains all possible properties and values from
  6182  // [BetaBase64PDFSource], [BetaPlainTextSource].
  6183  //
  6184  // Use the [BetaDocumentBlockSourceUnion.AsAny] method to switch on the variant.
  6185  //
  6186  // Use the methods beginning with 'As' to cast the union to one of its variants.
  6187  type BetaDocumentBlockSourceUnion struct {
  6188  	Data      string `json:"data"`
  6189  	MediaType string `json:"media_type"`
  6190  	// Any of "base64", "text".
  6191  	Type string `json:"type"`
  6192  	JSON struct {
  6193  		Data      respjson.Field
  6194  		MediaType respjson.Field
  6195  		Type      respjson.Field
  6196  		raw       string
  6197  	} `json:"-"`
  6198  }
  6199  
  6200  // anyBetaDocumentBlockSource is implemented by each variant of
  6201  // [BetaDocumentBlockSourceUnion] to add type safety for the return type of
  6202  // [BetaDocumentBlockSourceUnion.AsAny]
  6203  type anyBetaDocumentBlockSource interface {
  6204  	implBetaDocumentBlockSourceUnion()
  6205  }
  6206  
  6207  func (BetaBase64PDFSource) implBetaDocumentBlockSourceUnion() {}
  6208  func (BetaPlainTextSource) implBetaDocumentBlockSourceUnion() {}
  6209  
  6210  // Use the following switch statement to find the correct variant
  6211  //
  6212  //	switch variant := BetaDocumentBlockSourceUnion.AsAny().(type) {
  6213  //	case anthropic.BetaBase64PDFSource:
  6214  //	case anthropic.BetaPlainTextSource:
  6215  //	default:
  6216  //	  fmt.Errorf("no variant present")
  6217  //	}
  6218  func (u BetaDocumentBlockSourceUnion) AsAny() anyBetaDocumentBlockSource {
  6219  	switch u.Type {
  6220  	case "base64":
  6221  		return u.AsBase64()
  6222  	case "text":
  6223  		return u.AsText()
  6224  	}
  6225  	return nil
  6226  }
  6227  
  6228  func (u BetaDocumentBlockSourceUnion) AsBase64() (v BetaBase64PDFSource) {
  6229  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6230  	return
  6231  }
  6232  
  6233  func (u BetaDocumentBlockSourceUnion) AsText() (v BetaPlainTextSource) {
  6234  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6235  	return
  6236  }
  6237  
  6238  // Returns the unmodified JSON received from the API
  6239  func (u BetaDocumentBlockSourceUnion) RawJSON() string { return u.JSON.raw }
  6240  
  6241  func (r *BetaDocumentBlockSourceUnion) UnmarshalJSON(data []byte) error {
  6242  	return apijson.UnmarshalRoot(data, r)
  6243  }
  6244  
  6245  // Code execution result with encrypted stdout for PFC + web_search results.
  6246  type BetaEncryptedCodeExecutionResultBlock struct {
  6247  	Content         []BetaCodeExecutionOutputBlock        `json:"content" api:"required"`
  6248  	EncryptedStdout string                                `json:"encrypted_stdout" api:"required"`
  6249  	ReturnCode      int64                                 `json:"return_code" api:"required"`
  6250  	Stderr          string                                `json:"stderr" api:"required"`
  6251  	Type            constant.EncryptedCodeExecutionResult `json:"type" default:"encrypted_code_execution_result"`
  6252  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6253  	JSON struct {
  6254  		Content         respjson.Field
  6255  		EncryptedStdout respjson.Field
  6256  		ReturnCode      respjson.Field
  6257  		Stderr          respjson.Field
  6258  		Type            respjson.Field
  6259  		ExtraFields     map[string]respjson.Field
  6260  		raw             string
  6261  	} `json:"-"`
  6262  }
  6263  
  6264  // Returns the unmodified JSON received from the API
  6265  func (r BetaEncryptedCodeExecutionResultBlock) RawJSON() string { return r.JSON.raw }
  6266  func (r *BetaEncryptedCodeExecutionResultBlock) UnmarshalJSON(data []byte) error {
  6267  	return apijson.UnmarshalRoot(data, r)
  6268  }
  6269  
  6270  // Code execution result with encrypted stdout for PFC + web_search results.
  6271  //
  6272  // The properties Content, EncryptedStdout, ReturnCode, Stderr, Type are required.
  6273  type BetaEncryptedCodeExecutionResultBlockParam struct {
  6274  	Content         []BetaCodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
  6275  	EncryptedStdout string                              `json:"encrypted_stdout" api:"required"`
  6276  	ReturnCode      int64                               `json:"return_code" api:"required"`
  6277  	Stderr          string                              `json:"stderr" api:"required"`
  6278  	// This field can be elided, and will marshal its zero value as
  6279  	// "encrypted_code_execution_result".
  6280  	Type constant.EncryptedCodeExecutionResult `json:"type" default:"encrypted_code_execution_result"`
  6281  	paramObj
  6282  }
  6283  
  6284  func (r BetaEncryptedCodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error) {
  6285  	type shadow BetaEncryptedCodeExecutionResultBlockParam
  6286  	return param.MarshalObject(r, (*shadow)(&r))
  6287  }
  6288  func (r *BetaEncryptedCodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error {
  6289  	return apijson.UnmarshalRoot(data, r)
  6290  }
  6291  
  6292  // Marks the point in `content` where one model's output gives way to the next.
  6293  //
  6294  // One block appears per hop where a preceding model actually ran this turn and
  6295  // declined. A turn where no preceding model ran and declined has no such boundary
  6296  // and carries no block — the signal for whether a fallback model served the
  6297  // response is the presence of a `fallback_message` entry in `usage.iterations`,
  6298  // not this block.
  6299  //
  6300  // The block is treated like a server-tool content block for streaming: it arrives
  6301  // via the standard `content_block_start` / `content_block_stop` pair and carries
  6302  // no deltas.
  6303  type BetaFallbackBlock struct {
  6304  	// The model whose output ends at this point — the model that declined at this hop.
  6305  	// When the declining hop is the requested model, its `model` echoes the top-level
  6306  	// `model` string the caller sent (alias or canonical); when the declining hop is a
  6307  	// fallback model, its `model` is that model's canonical id.
  6308  	From BetaFallbackInfo `json:"from" api:"required"`
  6309  	// The fallback model producing the content that follows this block. Its `model` is
  6310  	// always the canonical id.
  6311  	To BetaFallbackInfo `json:"to" api:"required"`
  6312  	// What caused the `from` model to hand over at this hop.
  6313  	Trigger BetaFallbackRefusalTrigger `json:"trigger" api:"required"`
  6314  	Type    constant.Fallback          `json:"type" default:"fallback"`
  6315  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6316  	JSON struct {
  6317  		From        respjson.Field
  6318  		To          respjson.Field
  6319  		Trigger     respjson.Field
  6320  		Type        respjson.Field
  6321  		ExtraFields map[string]respjson.Field
  6322  		raw         string
  6323  	} `json:"-"`
  6324  }
  6325  
  6326  // Returns the unmodified JSON received from the API
  6327  func (r BetaFallbackBlock) RawJSON() string { return r.JSON.raw }
  6328  func (r *BetaFallbackBlock) UnmarshalJSON(data []byte) error {
  6329  	return apijson.UnmarshalRoot(data, r)
  6330  }
  6331  
  6332  // A `fallback` block echoed back from a prior response.
  6333  //
  6334  // Accepted in `messages[].content` and not rendered into the prompt; not validated
  6335  // against the request's `fallbacks` chain or top-level `model`.
  6336  //
  6337  // Echo the assistant turn back verbatim, including this block in its original
  6338  // position. The block marks the boundary between content produced before and after
  6339  // a fallback hop, and the server relies on that boundary to validate the turn:
  6340  // when thinking runs flank the boundary, omitting the block merges them into one
  6341  // span the server cannot validate (the request is rejected), and moving it into
  6342  // the middle of a single run is likewise rejected; between non-thinking blocks the
  6343  // block's placement has no validation effect.
  6344  //
  6345  // The properties From, To, Type are required.
  6346  type BetaFallbackBlockParam struct {
  6347  	// Identifies one hop of a fallback transition.
  6348  	From BetaFallbackInfoParam `json:"from,omitzero" api:"required"`
  6349  	// Identifies one hop of a fallback transition.
  6350  	To BetaFallbackInfoParam `json:"to,omitzero" api:"required"`
  6351  	// The response block's `trigger`, echoed verbatim. Accepted and ignored by the
  6352  	// server; any object or `null` is allowed.
  6353  	Trigger any `json:"trigger,omitzero"`
  6354  	// This field can be elided, and will marshal its zero value as "fallback".
  6355  	Type constant.Fallback `json:"type" default:"fallback"`
  6356  	paramObj
  6357  }
  6358  
  6359  func (r BetaFallbackBlockParam) MarshalJSON() (data []byte, err error) {
  6360  	type shadow BetaFallbackBlockParam
  6361  	return param.MarshalObject(r, (*shadow)(&r))
  6362  }
  6363  func (r *BetaFallbackBlockParam) UnmarshalJSON(data []byte) error {
  6364  	return apijson.UnmarshalRoot(data, r)
  6365  }
  6366  
  6367  // No reprice was applied; `reason` says why.
  6368  type BetaFallbackCreditNotApplied struct {
  6369  	// Why the reprice was not applied.
  6370  	//
  6371  	// A closed enum; additions to the redemption-check vocabulary arrive as deliberate
  6372  	// schema updates.
  6373  	//
  6374  	// Any of "body_mismatch", "continuation_excluded", "continuation_only", "expired",
  6375  	// "invalid_target_model", "not_enabled", "reprice_unavailable",
  6376  	// "temporarily_unavailable", "variant_fields_present", "wrong_organization",
  6377  	// "wrong_platform", "wrong_workspace".
  6378  	Reason BetaFallbackCreditNotAppliedReason `json:"reason" api:"required"`
  6379  	Type   constant.NotApplied                `json:"type" default:"not_applied"`
  6380  	// Request fields to remove before retrying, so the retry can redeem this token.
  6381  	//
  6382  	// Present exactly when `reason` is `variant_fields_present` — never null, never an
  6383  	// empty array; absent otherwise. Fields are named only from your own request, and
  6384  	// only after the sealed variant hash matched. A served best-effort retry has
  6385  	// already been billed at normal price; nothing redeems retroactively, but a
  6386  	// corrected re-send inside the token's five-minute window can still redeem.
  6387  	RemoveToRedeem []string `json:"remove_to_redeem" api:"nullable"`
  6388  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6389  	JSON struct {
  6390  		Reason         respjson.Field
  6391  		Type           respjson.Field
  6392  		RemoveToRedeem respjson.Field
  6393  		ExtraFields    map[string]respjson.Field
  6394  		raw            string
  6395  	} `json:"-"`
  6396  }
  6397  
  6398  // Returns the unmodified JSON received from the API
  6399  func (r BetaFallbackCreditNotApplied) RawJSON() string { return r.JSON.raw }
  6400  func (r *BetaFallbackCreditNotApplied) UnmarshalJSON(data []byte) error {
  6401  	return apijson.UnmarshalRoot(data, r)
  6402  }
  6403  
  6404  // Why the reprice was not applied.
  6405  //
  6406  // A closed enum; additions to the redemption-check vocabulary arrive as deliberate
  6407  // schema updates.
  6408  type BetaFallbackCreditNotAppliedReason string
  6409  
  6410  const (
  6411  	BetaFallbackCreditNotAppliedReasonBodyMismatch           BetaFallbackCreditNotAppliedReason = "body_mismatch"
  6412  	BetaFallbackCreditNotAppliedReasonContinuationExcluded   BetaFallbackCreditNotAppliedReason = "continuation_excluded"
  6413  	BetaFallbackCreditNotAppliedReasonContinuationOnly       BetaFallbackCreditNotAppliedReason = "continuation_only"
  6414  	BetaFallbackCreditNotAppliedReasonExpired                BetaFallbackCreditNotAppliedReason = "expired"
  6415  	BetaFallbackCreditNotAppliedReasonInvalidTargetModel     BetaFallbackCreditNotAppliedReason = "invalid_target_model"
  6416  	BetaFallbackCreditNotAppliedReasonNotEnabled             BetaFallbackCreditNotAppliedReason = "not_enabled"
  6417  	BetaFallbackCreditNotAppliedReasonRepriceUnavailable     BetaFallbackCreditNotAppliedReason = "reprice_unavailable"
  6418  	BetaFallbackCreditNotAppliedReasonTemporarilyUnavailable BetaFallbackCreditNotAppliedReason = "temporarily_unavailable"
  6419  	BetaFallbackCreditNotAppliedReasonVariantFieldsPresent   BetaFallbackCreditNotAppliedReason = "variant_fields_present"
  6420  	BetaFallbackCreditNotAppliedReasonWrongOrganization      BetaFallbackCreditNotAppliedReason = "wrong_organization"
  6421  	BetaFallbackCreditNotAppliedReasonWrongPlatform          BetaFallbackCreditNotAppliedReason = "wrong_platform"
  6422  	BetaFallbackCreditNotAppliedReasonWrongWorkspace         BetaFallbackCreditNotAppliedReason = "wrong_workspace"
  6423  )
  6424  
  6425  // The reprice was applied: the retry is billed as if the conversation had been on
  6426  // the retry model all along.
  6427  type BetaFallbackCreditRedeemed struct {
  6428  	Type constant.Redeemed `json:"type" default:"redeemed"`
  6429  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6430  	JSON struct {
  6431  		Type        respjson.Field
  6432  		ExtraFields map[string]respjson.Field
  6433  		raw         string
  6434  	} `json:"-"`
  6435  }
  6436  
  6437  // Returns the unmodified JSON received from the API
  6438  func (r BetaFallbackCreditRedeemed) RawJSON() string { return r.JSON.raw }
  6439  func (r *BetaFallbackCreditRedeemed) UnmarshalJSON(data []byte) error {
  6440  	return apijson.UnmarshalRoot(data, r)
  6441  }
  6442  
  6443  // Object form of `fallback_credit_token`: the token plus a redemption mode.
  6444  //
  6445  // Requires `anthropic-beta: fallback-credit-2026-07-01`; without that header the
  6446  // field accepts the bare string only. The bare string and the mode-less object are
  6447  // equivalent (both select `strict`), so wrapping an existing token changes nothing
  6448  // by itself.
  6449  //
  6450  // The property Token is required.
  6451  type BetaFallbackCreditTokenParam struct {
  6452  	// The opaque `fallback_credit_token` from a prior refusal's `stop_details` — the
  6453  	// same string the bare-string form carries.
  6454  	Token string `json:"token" api:"required"`
  6455  	// How a failing token affects the retry. `strict` (the default, and the
  6456  	// bare-string behavior): a failing redemption is a 400 and the retry is not
  6457  	// served. `best_effort`: the retry is served either way — a token-layer failure no
  6458  	// longer rejects the request; the retry proceeds at normal price and the outcome
  6459  	// is reported on the response's `usage.fallback_credit`. Two failures stay hard in
  6460  	// both modes: a malformed token, and combining `fallback_credit_token` with
  6461  	// `fallbacks`.
  6462  	//
  6463  	// Any of "strict", "best_effort".
  6464  	Mode BetaFallbackCreditTokenParamMode `json:"mode,omitzero"`
  6465  	paramObj
  6466  }
  6467  
  6468  func (r BetaFallbackCreditTokenParam) MarshalJSON() (data []byte, err error) {
  6469  	type shadow BetaFallbackCreditTokenParam
  6470  	return param.MarshalObject(r, (*shadow)(&r))
  6471  }
  6472  func (r *BetaFallbackCreditTokenParam) UnmarshalJSON(data []byte) error {
  6473  	return apijson.UnmarshalRoot(data, r)
  6474  }
  6475  
  6476  // How a failing token affects the retry. `strict` (the default, and the
  6477  // bare-string behavior): a failing redemption is a 400 and the retry is not
  6478  // served. `best_effort`: the retry is served either way — a token-layer failure no
  6479  // longer rejects the request; the retry proceeds at normal price and the outcome
  6480  // is reported on the response's `usage.fallback_credit`. Two failures stay hard in
  6481  // both modes: a malformed token, and combining `fallback_credit_token` with
  6482  // `fallbacks`.
  6483  type BetaFallbackCreditTokenParamMode string
  6484  
  6485  const (
  6486  	BetaFallbackCreditTokenParamModeStrict     BetaFallbackCreditTokenParamMode = "strict"
  6487  	BetaFallbackCreditTokenParamModeBestEffort BetaFallbackCreditTokenParamMode = "best_effort"
  6488  )
  6489  
  6490  // Outcome of the `fallback_credit_token` presented on this request.
  6491  type BetaFallbackCreditUsage struct {
  6492  	// Whether the fallback-credit reprice was applied to this response's billing.
  6493  	//
  6494  	// A union discriminated on `type`. `redeemed`: the retry is billed as if the
  6495  	// conversation had been on the retry model all along — including when the
  6496  	// resulting shift is zero because there was nothing to move. `not_applied`: no
  6497  	// reprice was applied; the arm's `reason` says why.
  6498  	Status BetaFallbackCreditUsageStatusUnion `json:"status" api:"required"`
  6499  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6500  	JSON struct {
  6501  		Status      respjson.Field
  6502  		ExtraFields map[string]respjson.Field
  6503  		raw         string
  6504  	} `json:"-"`
  6505  }
  6506  
  6507  // Returns the unmodified JSON received from the API
  6508  func (r BetaFallbackCreditUsage) RawJSON() string { return r.JSON.raw }
  6509  func (r *BetaFallbackCreditUsage) UnmarshalJSON(data []byte) error {
  6510  	return apijson.UnmarshalRoot(data, r)
  6511  }
  6512  
  6513  // BetaFallbackCreditUsageStatusUnion contains all possible properties and values
  6514  // from [BetaFallbackCreditRedeemed], [BetaFallbackCreditNotApplied].
  6515  //
  6516  // Use the [BetaFallbackCreditUsageStatusUnion.AsAny] method to switch on the
  6517  // variant.
  6518  //
  6519  // Use the methods beginning with 'As' to cast the union to one of its variants.
  6520  type BetaFallbackCreditUsageStatusUnion struct {
  6521  	// Any of "redeemed", "not_applied".
  6522  	Type string `json:"type"`
  6523  	// This field is from variant [BetaFallbackCreditNotApplied].
  6524  	Reason BetaFallbackCreditNotAppliedReason `json:"reason"`
  6525  	// This field is from variant [BetaFallbackCreditNotApplied].
  6526  	RemoveToRedeem []string `json:"remove_to_redeem"`
  6527  	JSON           struct {
  6528  		Type           respjson.Field
  6529  		Reason         respjson.Field
  6530  		RemoveToRedeem respjson.Field
  6531  		raw            string
  6532  	} `json:"-"`
  6533  }
  6534  
  6535  // anyBetaFallbackCreditUsageStatus is implemented by each variant of
  6536  // [BetaFallbackCreditUsageStatusUnion] to add type safety for the return type of
  6537  // [BetaFallbackCreditUsageStatusUnion.AsAny]
  6538  type anyBetaFallbackCreditUsageStatus interface {
  6539  	implBetaFallbackCreditUsageStatusUnion()
  6540  }
  6541  
  6542  func (BetaFallbackCreditRedeemed) implBetaFallbackCreditUsageStatusUnion()   {}
  6543  func (BetaFallbackCreditNotApplied) implBetaFallbackCreditUsageStatusUnion() {}
  6544  
  6545  // Use the following switch statement to find the correct variant
  6546  //
  6547  //	switch variant := BetaFallbackCreditUsageStatusUnion.AsAny().(type) {
  6548  //	case anthropic.BetaFallbackCreditRedeemed:
  6549  //	case anthropic.BetaFallbackCreditNotApplied:
  6550  //	default:
  6551  //	  fmt.Errorf("no variant present")
  6552  //	}
  6553  func (u BetaFallbackCreditUsageStatusUnion) AsAny() anyBetaFallbackCreditUsageStatus {
  6554  	switch u.Type {
  6555  	case "redeemed":
  6556  		return u.AsRedeemed()
  6557  	case "not_applied":
  6558  		return u.AsNotApplied()
  6559  	}
  6560  	return nil
  6561  }
  6562  
  6563  func (u BetaFallbackCreditUsageStatusUnion) AsRedeemed() (v BetaFallbackCreditRedeemed) {
  6564  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6565  	return
  6566  }
  6567  
  6568  func (u BetaFallbackCreditUsageStatusUnion) AsNotApplied() (v BetaFallbackCreditNotApplied) {
  6569  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  6570  	return
  6571  }
  6572  
  6573  // Returns the unmodified JSON received from the API
  6574  func (u BetaFallbackCreditUsageStatusUnion) RawJSON() string { return u.JSON.raw }
  6575  
  6576  func (r *BetaFallbackCreditUsageStatusUnion) UnmarshalJSON(data []byte) error {
  6577  	return apijson.UnmarshalRoot(data, r)
  6578  }
  6579  
  6580  // Identifies one hop of a fallback transition.
  6581  type BetaFallbackInfo struct {
  6582  	// The model that will complete your prompt.
  6583  	//
  6584  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
  6585  	// details and options.
  6586  	Model Model `json:"model" api:"required"`
  6587  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6588  	JSON struct {
  6589  		Model       respjson.Field
  6590  		ExtraFields map[string]respjson.Field
  6591  		raw         string
  6592  	} `json:"-"`
  6593  }
  6594  
  6595  // Returns the unmodified JSON received from the API
  6596  func (r BetaFallbackInfo) RawJSON() string { return r.JSON.raw }
  6597  func (r *BetaFallbackInfo) UnmarshalJSON(data []byte) error {
  6598  	return apijson.UnmarshalRoot(data, r)
  6599  }
  6600  
  6601  // Identifies one hop of a fallback transition.
  6602  //
  6603  // The property Model is required.
  6604  type BetaFallbackInfoParam struct {
  6605  	// The model that will complete your prompt.
  6606  	//
  6607  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
  6608  	// details and options.
  6609  	Model Model `json:"model,omitzero" api:"required"`
  6610  	paramObj
  6611  }
  6612  
  6613  func (r BetaFallbackInfoParam) MarshalJSON() (data []byte, err error) {
  6614  	type shadow BetaFallbackInfoParam
  6615  	return param.MarshalObject(r, (*shadow)(&r))
  6616  }
  6617  func (r *BetaFallbackInfoParam) UnmarshalJSON(data []byte) error {
  6618  	return apijson.UnmarshalRoot(data, r)
  6619  }
  6620  
  6621  // Token usage for the fallback-model attempt of a server-side fallback request.
  6622  //
  6623  // Produced in place of a `message` entry for whichever hop served the response. A
  6624  // declined hop produces the existing `message` entry. Whether a fallback model
  6625  // served the response is signalled by the presence of this entry in
  6626  // `usage.iterations`.
  6627  type BetaFallbackMessageIterationUsage struct {
  6628  	// Breakdown of cached tokens by TTL
  6629  	CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
  6630  	// The number of input tokens used to create the cache entry.
  6631  	CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
  6632  	// The number of input tokens read from the cache.
  6633  	CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
  6634  	// The number of input tokens which were used.
  6635  	InputTokens int64 `json:"input_tokens" api:"required"`
  6636  	// The model that will complete your prompt.
  6637  	//
  6638  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
  6639  	// details and options.
  6640  	Model Model `json:"model" api:"required"`
  6641  	// The number of output tokens which were used.
  6642  	OutputTokens int64 `json:"output_tokens" api:"required"`
  6643  	// Usage for the fallback-model attempt that served the response
  6644  	Type constant.FallbackMessage `json:"type" default:"fallback_message"`
  6645  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6646  	JSON struct {
  6647  		CacheCreation            respjson.Field
  6648  		CacheCreationInputTokens respjson.Field
  6649  		CacheReadInputTokens     respjson.Field
  6650  		InputTokens              respjson.Field
  6651  		Model                    respjson.Field
  6652  		OutputTokens             respjson.Field
  6653  		Type                     respjson.Field
  6654  		ExtraFields              map[string]respjson.Field
  6655  		raw                      string
  6656  	} `json:"-"`
  6657  }
  6658  
  6659  // Returns the unmodified JSON received from the API
  6660  func (r BetaFallbackMessageIterationUsage) RawJSON() string { return r.JSON.raw }
  6661  func (r *BetaFallbackMessageIterationUsage) UnmarshalJSON(data []byte) error {
  6662  	return apijson.UnmarshalRoot(data, r)
  6663  }
  6664  
  6665  // One entry in the `fallbacks` chain on a `/v1/messages` request.
  6666  //
  6667  // `model` is required. The override fields (`max_tokens`, `thinking`,
  6668  // `output_config`, and `speed`) set the corresponding parameter for this attempt
  6669  // only and are validated as if the request were made to `model`. Any other key is
  6670  // rejected at parse time.
  6671  //
  6672  // The property Model is required.
  6673  type BetaFallbackParam struct {
  6674  	// The model that will complete your prompt.
  6675  	//
  6676  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
  6677  	// details and options.
  6678  	Model     Model            `json:"model,omitzero" api:"required"`
  6679  	MaxTokens param.Opt[int64] `json:"max_tokens,omitzero"`
  6680  	// Inference speed mode. `fast` provides significantly faster output token
  6681  	// generation at premium pricing. Not all models support `fast`; invalid
  6682  	// combinations are rejected at create time.
  6683  	//
  6684  	// Any of "standard", "fast".
  6685  	Speed        BetaFallbackParamSpeed         `json:"speed,omitzero"`
  6686  	Thinking     BetaFallbackParamThinkingUnion `json:"thinking,omitzero"`
  6687  	OutputConfig BetaOutputConfigParam          `json:"output_config,omitzero"`
  6688  	ExtraFields  map[string]any                 `json:"-"`
  6689  	paramObj
  6690  }
  6691  
  6692  func (r BetaFallbackParam) MarshalJSON() (data []byte, err error) {
  6693  	type shadow BetaFallbackParam
  6694  	return param.MarshalWithExtras(r, (*shadow)(&r), r.ExtraFields)
  6695  }
  6696  func (r *BetaFallbackParam) UnmarshalJSON(data []byte) error {
  6697  	return apijson.UnmarshalRoot(data, r)
  6698  }
  6699  
  6700  // Inference speed mode. `fast` provides significantly faster output token
  6701  // generation at premium pricing. Not all models support `fast`; invalid
  6702  // combinations are rejected at create time.
  6703  type BetaFallbackParamSpeed string
  6704  
  6705  const (
  6706  	BetaFallbackParamSpeedStandard BetaFallbackParamSpeed = "standard"
  6707  	BetaFallbackParamSpeedFast     BetaFallbackParamSpeed = "fast"
  6708  )
  6709  
  6710  // Only one field can be non-zero.
  6711  //
  6712  // Use [param.IsOmitted] to confirm if a field is set.
  6713  type BetaFallbackParamThinkingUnion struct {
  6714  	OfEnabled  *BetaThinkingConfigEnabledParam  `json:",omitzero,inline"`
  6715  	OfDisabled *BetaThinkingConfigDisabledParam `json:",omitzero,inline"`
  6716  	OfAdaptive *BetaThinkingConfigAdaptiveParam `json:",omitzero,inline"`
  6717  	paramUnion
  6718  }
  6719  
  6720  func (u BetaFallbackParamThinkingUnion) MarshalJSON() ([]byte, error) {
  6721  	return param.MarshalUnion(u, u.OfEnabled, u.OfDisabled, u.OfAdaptive)
  6722  }
  6723  func (u *BetaFallbackParamThinkingUnion) UnmarshalJSON(data []byte) error {
  6724  	return apijson.UnmarshalRoot(data, u)
  6725  }
  6726  
  6727  func (u *BetaFallbackParamThinkingUnion) asAny() any {
  6728  	if !param.IsOmitted(u.OfEnabled) {
  6729  		return u.OfEnabled
  6730  	} else if !param.IsOmitted(u.OfDisabled) {
  6731  		return u.OfDisabled
  6732  	} else if !param.IsOmitted(u.OfAdaptive) {
  6733  		return u.OfAdaptive
  6734  	}
  6735  	return nil
  6736  }
  6737  
  6738  // Returns a pointer to the underlying variant's property, if present.
  6739  func (u BetaFallbackParamThinkingUnion) GetBudgetTokens() *int64 {
  6740  	if vt := u.OfEnabled; vt != nil {
  6741  		return &vt.BudgetTokens
  6742  	}
  6743  	return nil
  6744  }
  6745  
  6746  // Returns a pointer to the underlying variant's property, if present.
  6747  func (u BetaFallbackParamThinkingUnion) GetType() *string {
  6748  	if vt := u.OfEnabled; vt != nil {
  6749  		return (*string)(&vt.Type)
  6750  	} else if vt := u.OfDisabled; vt != nil {
  6751  		return (*string)(&vt.Type)
  6752  	} else if vt := u.OfAdaptive; vt != nil {
  6753  		return (*string)(&vt.Type)
  6754  	}
  6755  	return nil
  6756  }
  6757  
  6758  // Returns a pointer to the underlying variant's property, if present.
  6759  func (u BetaFallbackParamThinkingUnion) GetDisplay() *string {
  6760  	if vt := u.OfEnabled; vt != nil {
  6761  		return (*string)(&vt.Display)
  6762  	} else if vt := u.OfAdaptive; vt != nil {
  6763  		return (*string)(&vt.Display)
  6764  	}
  6765  	return nil
  6766  }
  6767  
  6768  // Returns a pointer to the underlying variant's BlockBinding property, if present.
  6769  func (u BetaFallbackParamThinkingUnion) GetBlockBinding() *BetaThinkingBlockBindingParam {
  6770  	if vt := u.OfEnabled; vt != nil {
  6771  		return &vt.BlockBinding
  6772  	} else if vt := u.OfAdaptive; vt != nil {
  6773  		return &vt.BlockBinding
  6774  	}
  6775  	return nil
  6776  }
  6777  
  6778  func init() {
  6779  	apijson.RegisterUnion[BetaFallbackParamThinkingUnion](
  6780  		"type",
  6781  		apijson.Discriminator[BetaThinkingConfigEnabledParam]("enabled"),
  6782  		apijson.Discriminator[BetaThinkingConfigDisabledParam]("disabled"),
  6783  		apijson.Discriminator[BetaThinkingConfigAdaptiveParam]("adaptive"),
  6784  	)
  6785  }
  6786  
  6787  // The `from` model declined for policy reasons.
  6788  type BetaFallbackRefusalTrigger struct {
  6789  	// The policy category that triggered a refusal.
  6790  	//
  6791  	// Any of "cyber", "bio", "frontier_llm", "reasoning_extraction", "general_harms".
  6792  	Category BetaFallbackRefusalTriggerCategory `json:"category" api:"required"`
  6793  	Type     constant.Refusal                   `json:"type" default:"refusal"`
  6794  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  6795  	JSON struct {
  6796  		Category    respjson.Field
  6797  		Type        respjson.Field
  6798  		ExtraFields map[string]respjson.Field
  6799  		raw         string
  6800  	} `json:"-"`
  6801  }
  6802  
  6803  // Returns the unmodified JSON received from the API
  6804  func (r BetaFallbackRefusalTrigger) RawJSON() string { return r.JSON.raw }
  6805  func (r *BetaFallbackRefusalTrigger) UnmarshalJSON(data []byte) error {
  6806  	return apijson.UnmarshalRoot(data, r)
  6807  }
  6808  
  6809  // The policy category that triggered a refusal.
  6810  type BetaFallbackRefusalTriggerCategory string
  6811  
  6812  const (
  6813  	BetaFallbackRefusalTriggerCategoryCyber               BetaFallbackRefusalTriggerCategory = "cyber"
  6814  	BetaFallbackRefusalTriggerCategoryBio                 BetaFallbackRefusalTriggerCategory = "bio"
  6815  	BetaFallbackRefusalTriggerCategoryFrontierLLM         BetaFallbackRefusalTriggerCategory = "frontier_llm"
  6816  	BetaFallbackRefusalTriggerCategoryReasoningExtraction BetaFallbackRefusalTriggerCategory = "reasoning_extraction"
  6817  	BetaFallbackRefusalTriggerCategoryGeneralHarms        BetaFallbackRefusalTriggerCategory = "general_harms"
  6818  )
  6819  
  6820  func BetaFallbacksParamOfDefault() BetaFallbacksParamUnion {
  6821  	return BetaFallbacksParamUnion{OfDefault: constant.ValueOf[constant.Default]()}
  6822  }
  6823  
  6824  // Only one field can be non-zero.
  6825  //
  6826  // Use [param.IsOmitted] to confirm if a field is set.
  6827  type BetaFallbacksParamUnion struct {
  6828  	OfBetaFallbackArray []BetaFallbackParam `json:",omitzero,inline"`
  6829  	// Construct this variant with constant.ValueOf[constant.Default]()
  6830  	OfDefault constant.Default `json:",omitzero,inline"`
  6831  	paramUnion
  6832  }
  6833  
  6834  func (u BetaFallbacksParamUnion) MarshalJSON() ([]byte, error) {
  6835  	return param.MarshalUnion(u, u.OfBetaFallbackArray, u.OfDefault)
  6836  }
  6837  func (u *BetaFallbacksParamUnion) UnmarshalJSON(data []byte) error {
  6838  	return apijson.UnmarshalRoot(data, u)
  6839  }
  6840  
  6841  func (u *BetaFallbacksParamUnion) asAny() any {
  6842  	if !param.IsOmitted(u.OfBetaFallbackArray) {
  6843  		return &u.OfBetaFallbackArray
  6844  	} else if !param.IsOmitted(u.OfDefault) {
  6845  		return &u.OfDefault
  6846  	}
  6847  	return nil
  6848  }
  6849  
  6850  // The properties FileID, Type are required.
  6851  type BetaFileDocumentSourceParam struct {
  6852  	FileID string `json:"file_id" api:"required"`
  6853  	// This field can be elided, and will marshal its zero value as "file".
  6854  	Type constant.File `json:"type" default:"file"`
  6855  	paramObj
  6856  }
  6857  
  6858  func (r BetaFileDocumentSourceParam) MarshalJSON() (data []byte, err error) {
  6859  	type shadow BetaFileDocumentSourceParam
  6860  	return param.MarshalObject(r, (*shadow)(&r))
  6861  }
  6862  func (r *BetaFileDocumentSourceParam) UnmarshalJSON(data []byte) error {
  6863  	return apijson.UnmarshalRoot(data, r)
  6864  }
  6865  
  6866  // The properties FileID, Type are required.
  6867  type BetaFileImageSourceParam struct {
  6868  	FileID string `json:"file_id" api:"required"`
  6869  	// This field can be elided, and will marshal its zero value as "file".
  6870  	Type constant.File `json:"type" default:"file"`
  6871  	paramObj
  6872  }
  6873  
  6874  func (r BetaFileImageSourceParam) MarshalJSON() (data []byte, err error) {
  6875  	type shadow BetaFileImageSourceParam
  6876  	return param.MarshalObject(r, (*shadow)(&r))
  6877  }
  6878  func (r *BetaFileImageSourceParam) UnmarshalJSON(data []byte) error {
  6879  	return apijson.UnmarshalRoot(data, r)
  6880  }
  6881  
  6882  // The properties Source, Type are required.
  6883  type BetaImageBlockParam struct {
  6884  	Source BetaImageBlockParamSourceUnion `json:"source,omitzero" api:"required"`
  6885  	// Create a cache control breakpoint at this content block.
  6886  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  6887  	// Configures the transformations the server applies to this image before the model
  6888  	// observes it. Each key names a condition the server transforms images for; its
  6889  	// value selects the transformation applied. Omitted keys keep their default
  6890  	// behavior, and an empty object is equivalent to omitting the field.
  6891  	Transformations BetaImageTransformationsParam `json:"transformations,omitzero"`
  6892  	// This field can be elided, and will marshal its zero value as "image".
  6893  	Type constant.Image `json:"type" default:"image"`
  6894  	paramObj
  6895  }
  6896  
  6897  func (r BetaImageBlockParam) MarshalJSON() (data []byte, err error) {
  6898  	type shadow BetaImageBlockParam
  6899  	return param.MarshalObject(r, (*shadow)(&r))
  6900  }
  6901  func (r *BetaImageBlockParam) UnmarshalJSON(data []byte) error {
  6902  	return apijson.UnmarshalRoot(data, r)
  6903  }
  6904  
  6905  // Only one field can be non-zero.
  6906  //
  6907  // Use [param.IsOmitted] to confirm if a field is set.
  6908  type BetaImageBlockParamSourceUnion struct {
  6909  	OfBase64 *BetaBase64ImageSourceParam `json:",omitzero,inline"`
  6910  	OfURL    *BetaURLImageSourceParam    `json:",omitzero,inline"`
  6911  	OfFile   *BetaFileImageSourceParam   `json:",omitzero,inline"`
  6912  	paramUnion
  6913  }
  6914  
  6915  func (u BetaImageBlockParamSourceUnion) MarshalJSON() ([]byte, error) {
  6916  	return param.MarshalUnion(u, u.OfBase64, u.OfURL, u.OfFile)
  6917  }
  6918  func (u *BetaImageBlockParamSourceUnion) UnmarshalJSON(data []byte) error {
  6919  	return apijson.UnmarshalRoot(data, u)
  6920  }
  6921  
  6922  func (u *BetaImageBlockParamSourceUnion) asAny() any {
  6923  	if !param.IsOmitted(u.OfBase64) {
  6924  		return u.OfBase64
  6925  	} else if !param.IsOmitted(u.OfURL) {
  6926  		return u.OfURL
  6927  	} else if !param.IsOmitted(u.OfFile) {
  6928  		return u.OfFile
  6929  	}
  6930  	return nil
  6931  }
  6932  
  6933  // Returns a pointer to the underlying variant's property, if present.
  6934  func (u BetaImageBlockParamSourceUnion) GetData() *string {
  6935  	if vt := u.OfBase64; vt != nil {
  6936  		return &vt.Data
  6937  	}
  6938  	return nil
  6939  }
  6940  
  6941  // Returns a pointer to the underlying variant's property, if present.
  6942  func (u BetaImageBlockParamSourceUnion) GetMediaType() *string {
  6943  	if vt := u.OfBase64; vt != nil {
  6944  		return (*string)(&vt.MediaType)
  6945  	}
  6946  	return nil
  6947  }
  6948  
  6949  // Returns a pointer to the underlying variant's property, if present.
  6950  func (u BetaImageBlockParamSourceUnion) GetURL() *string {
  6951  	if vt := u.OfURL; vt != nil {
  6952  		return &vt.URL
  6953  	}
  6954  	return nil
  6955  }
  6956  
  6957  // Returns a pointer to the underlying variant's property, if present.
  6958  func (u BetaImageBlockParamSourceUnion) GetFileID() *string {
  6959  	if vt := u.OfFile; vt != nil {
  6960  		return &vt.FileID
  6961  	}
  6962  	return nil
  6963  }
  6964  
  6965  // Returns a pointer to the underlying variant's property, if present.
  6966  func (u BetaImageBlockParamSourceUnion) GetType() *string {
  6967  	if vt := u.OfBase64; vt != nil {
  6968  		return (*string)(&vt.Type)
  6969  	} else if vt := u.OfURL; vt != nil {
  6970  		return (*string)(&vt.Type)
  6971  	} else if vt := u.OfFile; vt != nil {
  6972  		return (*string)(&vt.Type)
  6973  	}
  6974  	return nil
  6975  }
  6976  
  6977  func init() {
  6978  	apijson.RegisterUnion[BetaImageBlockParamSourceUnion](
  6979  		"type",
  6980  		apijson.Discriminator[BetaBase64ImageSourceParam]("base64"),
  6981  		apijson.Discriminator[BetaURLImageSourceParam]("url"),
  6982  		apijson.Discriminator[BetaFileImageSourceParam]("file"),
  6983  	)
  6984  }
  6985  
  6986  // Configures the transformations the server applies to this image before the model
  6987  // observes it. Each key names a condition the server transforms images for; its
  6988  // value selects the transformation applied. Omitted keys keep their default
  6989  // behavior, and an empty object is equivalent to omitting the field.
  6990  type BetaImageTransformationsParam struct {
  6991  	// What the server does when this image exceeds the model's maximum image size.
  6992  	// `"downsize"` (the default) scales the image down to fit, which changes the
  6993  	// dimensions the model observes without telling you. `"error"` instead rejects the
  6994  	// request with a 400 error naming the image's dimensions and the largest
  6995  	// dimensions that fit, so you can scale the image deliberately — your image is
  6996  	// never silently scaled down.
  6997  	//
  6998  	// Any of "downsize", "error".
  6999  	OversizedImage BetaImageTransformationsParamOversizedImage `json:"oversized_image,omitzero"`
  7000  	paramObj
  7001  }
  7002  
  7003  func (r BetaImageTransformationsParam) MarshalJSON() (data []byte, err error) {
  7004  	type shadow BetaImageTransformationsParam
  7005  	return param.MarshalObject(r, (*shadow)(&r))
  7006  }
  7007  func (r *BetaImageTransformationsParam) UnmarshalJSON(data []byte) error {
  7008  	return apijson.UnmarshalRoot(data, r)
  7009  }
  7010  
  7011  // What the server does when this image exceeds the model's maximum image size.
  7012  // `"downsize"` (the default) scales the image down to fit, which changes the
  7013  // dimensions the model observes without telling you. `"error"` instead rejects the
  7014  // request with a 400 error naming the image's dimensions and the largest
  7015  // dimensions that fit, so you can scale the image deliberately — your image is
  7016  // never silently scaled down.
  7017  type BetaImageTransformationsParamOversizedImage string
  7018  
  7019  const (
  7020  	BetaImageTransformationsParamOversizedImageDownsize BetaImageTransformationsParamOversizedImage = "downsize"
  7021  	BetaImageTransformationsParamOversizedImageError    BetaImageTransformationsParamOversizedImage = "error"
  7022  )
  7023  
  7024  type BetaInputJSONDelta struct {
  7025  	PartialJSON string                  `json:"partial_json" api:"required"`
  7026  	Type        constant.InputJSONDelta `json:"type" default:"input_json_delta"`
  7027  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7028  	JSON struct {
  7029  		PartialJSON respjson.Field
  7030  		Type        respjson.Field
  7031  		ExtraFields map[string]respjson.Field
  7032  		raw         string
  7033  	} `json:"-"`
  7034  }
  7035  
  7036  // Returns the unmodified JSON received from the API
  7037  func (r BetaInputJSONDelta) RawJSON() string { return r.JSON.raw }
  7038  func (r *BetaInputJSONDelta) UnmarshalJSON(data []byte) error {
  7039  	return apijson.UnmarshalRoot(data, r)
  7040  }
  7041  
  7042  // The properties Type, Value are required.
  7043  type BetaInputTokensClearAtLeastParam struct {
  7044  	Value int64 `json:"value" api:"required"`
  7045  	// This field can be elided, and will marshal its zero value as "input_tokens".
  7046  	Type constant.InputTokens `json:"type" default:"input_tokens"`
  7047  	paramObj
  7048  }
  7049  
  7050  func (r BetaInputTokensClearAtLeastParam) MarshalJSON() (data []byte, err error) {
  7051  	type shadow BetaInputTokensClearAtLeastParam
  7052  	return param.MarshalObject(r, (*shadow)(&r))
  7053  }
  7054  func (r *BetaInputTokensClearAtLeastParam) UnmarshalJSON(data []byte) error {
  7055  	return apijson.UnmarshalRoot(data, r)
  7056  }
  7057  
  7058  // The properties Type, Value are required.
  7059  type BetaInputTokensTriggerParam struct {
  7060  	Value int64 `json:"value" api:"required"`
  7061  	// This field can be elided, and will marshal its zero value as "input_tokens".
  7062  	Type constant.InputTokens `json:"type" default:"input_tokens"`
  7063  	paramObj
  7064  }
  7065  
  7066  func (r BetaInputTokensTriggerParam) MarshalJSON() (data []byte, err error) {
  7067  	type shadow BetaInputTokensTriggerParam
  7068  	return param.MarshalObject(r, (*shadow)(&r))
  7069  }
  7070  func (r *BetaInputTokensTriggerParam) UnmarshalJSON(data []byte) error {
  7071  	return apijson.UnmarshalRoot(data, r)
  7072  }
  7073  
  7074  type BetaIterationsUsage []BetaIterationsUsageItemUnion
  7075  
  7076  // BetaIterationsUsageItemUnion contains all possible properties and values from
  7077  // [BetaMessageIterationUsage], [BetaCompactionIterationUsage],
  7078  // [BetaAdvisorMessageIterationUsage], [BetaFallbackMessageIterationUsage].
  7079  //
  7080  // Use the [BetaIterationsUsageItemUnion.AsAny] method to switch on the variant.
  7081  //
  7082  // Use the methods beginning with 'As' to cast the union to one of its variants.
  7083  type BetaIterationsUsageItemUnion struct {
  7084  	// This field is from variant [BetaMessageIterationUsage].
  7085  	CacheCreation            BetaCacheCreation `json:"cache_creation"`
  7086  	CacheCreationInputTokens int64             `json:"cache_creation_input_tokens"`
  7087  	CacheReadInputTokens     int64             `json:"cache_read_input_tokens"`
  7088  	InputTokens              int64             `json:"input_tokens"`
  7089  	// This field is from variant [BetaMessageIterationUsage].
  7090  	Model        Model `json:"model"`
  7091  	OutputTokens int64 `json:"output_tokens"`
  7092  	// Any of "message", "compaction", "advisor_message", "fallback_message".
  7093  	Type string `json:"type"`
  7094  	JSON struct {
  7095  		CacheCreation            respjson.Field
  7096  		CacheCreationInputTokens respjson.Field
  7097  		CacheReadInputTokens     respjson.Field
  7098  		InputTokens              respjson.Field
  7099  		Model                    respjson.Field
  7100  		OutputTokens             respjson.Field
  7101  		Type                     respjson.Field
  7102  		raw                      string
  7103  	} `json:"-"`
  7104  }
  7105  
  7106  // anyBetaIterationsUsageItem is implemented by each variant of
  7107  // [BetaIterationsUsageItemUnion] to add type safety for the return type of
  7108  // [BetaIterationsUsageItemUnion.AsAny]
  7109  type anyBetaIterationsUsageItem interface {
  7110  	implBetaIterationsUsageItemUnion()
  7111  }
  7112  
  7113  func (BetaMessageIterationUsage) implBetaIterationsUsageItemUnion()         {}
  7114  func (BetaCompactionIterationUsage) implBetaIterationsUsageItemUnion()      {}
  7115  func (BetaAdvisorMessageIterationUsage) implBetaIterationsUsageItemUnion()  {}
  7116  func (BetaFallbackMessageIterationUsage) implBetaIterationsUsageItemUnion() {}
  7117  
  7118  // Use the following switch statement to find the correct variant
  7119  //
  7120  //	switch variant := BetaIterationsUsageItemUnion.AsAny().(type) {
  7121  //	case anthropic.BetaMessageIterationUsage:
  7122  //	case anthropic.BetaCompactionIterationUsage:
  7123  //	case anthropic.BetaAdvisorMessageIterationUsage:
  7124  //	case anthropic.BetaFallbackMessageIterationUsage:
  7125  //	default:
  7126  //	  fmt.Errorf("no variant present")
  7127  //	}
  7128  func (u BetaIterationsUsageItemUnion) AsAny() anyBetaIterationsUsageItem {
  7129  	switch u.Type {
  7130  	case "message":
  7131  		return u.AsMessage()
  7132  	case "compaction":
  7133  		return u.AsCompaction()
  7134  	case "advisor_message":
  7135  		return u.AsAdvisorMessage()
  7136  	case "fallback_message":
  7137  		return u.AsFallbackMessage()
  7138  	}
  7139  	return nil
  7140  }
  7141  
  7142  func (u BetaIterationsUsageItemUnion) AsMessage() (v BetaMessageIterationUsage) {
  7143  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7144  	return
  7145  }
  7146  
  7147  func (u BetaIterationsUsageItemUnion) AsCompaction() (v BetaCompactionIterationUsage) {
  7148  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7149  	return
  7150  }
  7151  
  7152  func (u BetaIterationsUsageItemUnion) AsAdvisorMessage() (v BetaAdvisorMessageIterationUsage) {
  7153  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7154  	return
  7155  }
  7156  
  7157  func (u BetaIterationsUsageItemUnion) AsFallbackMessage() (v BetaFallbackMessageIterationUsage) {
  7158  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7159  	return
  7160  }
  7161  
  7162  // Returns the unmodified JSON received from the API
  7163  func (u BetaIterationsUsageItemUnion) RawJSON() string { return u.JSON.raw }
  7164  
  7165  func (r *BetaIterationsUsageItemUnion) UnmarshalJSON(data []byte) error {
  7166  	return apijson.UnmarshalRoot(data, r)
  7167  }
  7168  
  7169  // BetaJSONOutputFormatParam configures JSON structured output for a message request.
  7170  // The preferred usage is to pass a pointer to a Go struct as Schema. The SDK will
  7171  // auto-generate the JSON schema on the wire and auto-parse the response back into
  7172  // the struct after the request completes:
  7173  //
  7174  //	var result MyStruct
  7175  //	msg, _ := client.Beta.Messages.New(ctx, anthropic.BetaMessageNewParams{
  7176  //	    OutputFormat: anthropic.BetaJSONOutputFormatParam{Schema: &result},
  7177  //	    ...
  7178  //	})
  7179  //
  7180  // For streaming, call ParseOutput after accumulating the message:
  7181  //
  7182  //	msg.ParseOutput(&result)
  7183  //
  7184  // The properties Schema, Type are required.
  7185  type BetaJSONOutputFormatParam struct {
  7186  	// The JSON schema of the format.
  7187  	//
  7188  	// This can be a map[string]any, json.RawMessage, or a pointer to a Go struct.
  7189  	// When a struct pointer is provided, the SDK automatically generates the JSON
  7190  	// schema on the wire and can auto-parse the response back into the struct.
  7191  	// A struct pointer is preferred over map[string]any because it provides
  7192  	// auto-parsing and type safety. If you already have a JSON schema as bytes,
  7193  	// use json.RawMessage to avoid unnecessary marshaling overhead.
  7194  	//
  7195  	// Set the schema on either BetaMessageNewParams.OutputFormat or
  7196  	// BetaMessageNewParams.OutputConfig.Format, not both. If both carry a struct
  7197  	// pointer, OutputFormat wins for auto-parse.
  7198  	Schema any `json:"schema,omitzero" api:"required"`
  7199  	// This field can be elided, and will marshal its zero value as "json_schema".
  7200  	Type constant.JSONSchema `json:"type" default:"json_schema"`
  7201  	paramObj
  7202  }
  7203  
  7204  func (r BetaJSONOutputFormatParam) MarshalJSON() (data []byte, err error) {
  7205  	// Convert struct pointers and maps to json.RawMessage so the wire
  7206  	// payload contains a JSON schema, not the struct's field values.
  7207  	// Value receiver keeps the caller's Schema intact for auto-parse.
  7208  	if r.Schema != nil {
  7209  		raw, e := schemaToRaw(r.Schema)
  7210  		if e != nil {
  7211  			return nil, e
  7212  		}
  7213  		if raw != nil {
  7214  			r.Schema = raw
  7215  		}
  7216  	}
  7217  	type shadow BetaJSONOutputFormatParam
  7218  	return param.MarshalObject(r, (*shadow)(&r))
  7219  }
  7220  func (r *BetaJSONOutputFormatParam) UnmarshalJSON(data []byte) error {
  7221  	return apijson.UnmarshalRoot(data, r)
  7222  }
  7223  
  7224  // Configuration for a specific tool in an MCP toolset.
  7225  type BetaMCPToolConfigParam struct {
  7226  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  7227  	Enabled      param.Opt[bool] `json:"enabled,omitzero"`
  7228  	paramObj
  7229  }
  7230  
  7231  func (r BetaMCPToolConfigParam) MarshalJSON() (data []byte, err error) {
  7232  	type shadow BetaMCPToolConfigParam
  7233  	return param.MarshalObject(r, (*shadow)(&r))
  7234  }
  7235  func (r *BetaMCPToolConfigParam) UnmarshalJSON(data []byte) error {
  7236  	return apijson.UnmarshalRoot(data, r)
  7237  }
  7238  
  7239  // Default configuration for tools in an MCP toolset.
  7240  type BetaMCPToolDefaultConfigParam struct {
  7241  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  7242  	Enabled      param.Opt[bool] `json:"enabled,omitzero"`
  7243  	paramObj
  7244  }
  7245  
  7246  func (r BetaMCPToolDefaultConfigParam) MarshalJSON() (data []byte, err error) {
  7247  	type shadow BetaMCPToolDefaultConfigParam
  7248  	return param.MarshalObject(r, (*shadow)(&r))
  7249  }
  7250  func (r *BetaMCPToolDefaultConfigParam) UnmarshalJSON(data []byte) error {
  7251  	return apijson.UnmarshalRoot(data, r)
  7252  }
  7253  
  7254  type BetaMCPToolResultBlock struct {
  7255  	Content   BetaMCPToolResultBlockContentUnion `json:"content" api:"required"`
  7256  	IsError   bool                               `json:"is_error" api:"required"`
  7257  	ToolUseID string                             `json:"tool_use_id" api:"required"`
  7258  	Type      constant.MCPToolResult             `json:"type" default:"mcp_tool_result"`
  7259  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7260  	JSON struct {
  7261  		Content     respjson.Field
  7262  		IsError     respjson.Field
  7263  		ToolUseID   respjson.Field
  7264  		Type        respjson.Field
  7265  		ExtraFields map[string]respjson.Field
  7266  		raw         string
  7267  	} `json:"-"`
  7268  }
  7269  
  7270  // Returns the unmodified JSON received from the API
  7271  func (r BetaMCPToolResultBlock) RawJSON() string { return r.JSON.raw }
  7272  func (r *BetaMCPToolResultBlock) UnmarshalJSON(data []byte) error {
  7273  	return apijson.UnmarshalRoot(data, r)
  7274  }
  7275  
  7276  // BetaMCPToolResultBlockContentUnion contains all possible properties and values
  7277  // from [string], [[]BetaTextBlock].
  7278  //
  7279  // Use the methods beginning with 'As' to cast the union to one of its variants.
  7280  //
  7281  // If the underlying value is not a json object, one of the following properties
  7282  // will be valid: OfString OfBetaMCPToolResultBlockContent]
  7283  type BetaMCPToolResultBlockContentUnion struct {
  7284  	// This field will be present if the value is a [string] instead of an object.
  7285  	OfString string `json:",inline"`
  7286  	// This field will be present if the value is a [[]BetaTextBlock] instead of an
  7287  	// object.
  7288  	OfBetaMCPToolResultBlockContent []BetaTextBlock `json:",inline"`
  7289  	JSON                            struct {
  7290  		OfString                        respjson.Field
  7291  		OfBetaMCPToolResultBlockContent respjson.Field
  7292  		raw                             string
  7293  	} `json:"-"`
  7294  }
  7295  
  7296  func (u BetaMCPToolResultBlockContentUnion) AsString() (v string) {
  7297  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7298  	return
  7299  }
  7300  
  7301  func (u BetaMCPToolResultBlockContentUnion) AsBetaMCPToolResultBlockContent() (v []BetaTextBlock) {
  7302  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7303  	return
  7304  }
  7305  
  7306  // Returns the unmodified JSON received from the API
  7307  func (u BetaMCPToolResultBlockContentUnion) RawJSON() string { return u.JSON.raw }
  7308  
  7309  func (r *BetaMCPToolResultBlockContentUnion) UnmarshalJSON(data []byte) error {
  7310  	return apijson.UnmarshalRoot(data, r)
  7311  }
  7312  
  7313  type BetaMCPToolUseBlock struct {
  7314  	ID    string `json:"id" api:"required"`
  7315  	Input any    `json:"input" api:"required"`
  7316  	// The name of the MCP tool
  7317  	Name string `json:"name" api:"required"`
  7318  	// The name of the MCP server
  7319  	ServerName string              `json:"server_name" api:"required"`
  7320  	Type       constant.MCPToolUse `json:"type" default:"mcp_tool_use"`
  7321  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7322  	JSON struct {
  7323  		ID          respjson.Field
  7324  		Input       respjson.Field
  7325  		Name        respjson.Field
  7326  		ServerName  respjson.Field
  7327  		Type        respjson.Field
  7328  		ExtraFields map[string]respjson.Field
  7329  		raw         string
  7330  	} `json:"-"`
  7331  }
  7332  
  7333  // Returns the unmodified JSON received from the API
  7334  func (r BetaMCPToolUseBlock) RawJSON() string { return r.JSON.raw }
  7335  func (r *BetaMCPToolUseBlock) UnmarshalJSON(data []byte) error {
  7336  	return apijson.UnmarshalRoot(data, r)
  7337  }
  7338  
  7339  // The properties ID, Input, Name, ServerName, Type are required.
  7340  type BetaMCPToolUseBlockParam struct {
  7341  	ID    string `json:"id" api:"required"`
  7342  	Input any    `json:"input,omitzero" api:"required"`
  7343  	Name  string `json:"name" api:"required"`
  7344  	// The name of the MCP server
  7345  	ServerName string `json:"server_name" api:"required"`
  7346  	// Create a cache control breakpoint at this content block.
  7347  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  7348  	// This field can be elided, and will marshal its zero value as "mcp_tool_use".
  7349  	Type constant.MCPToolUse `json:"type" default:"mcp_tool_use"`
  7350  	paramObj
  7351  }
  7352  
  7353  func (r BetaMCPToolUseBlockParam) MarshalJSON() (data []byte, err error) {
  7354  	type shadow BetaMCPToolUseBlockParam
  7355  	return param.MarshalObject(r, (*shadow)(&r))
  7356  }
  7357  func (r *BetaMCPToolUseBlockParam) UnmarshalJSON(data []byte) error {
  7358  	return apijson.UnmarshalRoot(data, r)
  7359  }
  7360  
  7361  // Configuration for a group of tools from an MCP server.
  7362  //
  7363  // Allows configuring enabled status and defer_loading for all tools from an MCP
  7364  // server, with optional per-tool overrides.
  7365  //
  7366  // The properties MCPServerName, Type are required.
  7367  type BetaMCPToolsetParam struct {
  7368  	// Name of the MCP server to configure tools for
  7369  	MCPServerName string `json:"mcp_server_name" api:"required"`
  7370  	// Configuration overrides for specific tools, keyed by tool name
  7371  	Configs map[string]BetaMCPToolConfigParam `json:"configs,omitzero"`
  7372  	// Create a cache control breakpoint at this content block.
  7373  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  7374  	// Default configuration applied to all tools from this server
  7375  	DefaultConfig BetaMCPToolDefaultConfigParam `json:"default_config,omitzero"`
  7376  	// This field can be elided, and will marshal its zero value as "mcp_toolset".
  7377  	Type constant.MCPToolset `json:"type" default:"mcp_toolset"`
  7378  	paramObj
  7379  }
  7380  
  7381  func (r BetaMCPToolsetParam) MarshalJSON() (data []byte, err error) {
  7382  	type shadow BetaMCPToolsetParam
  7383  	return param.MarshalObject(r, (*shadow)(&r))
  7384  }
  7385  func (r *BetaMCPToolsetParam) UnmarshalJSON(data []byte) error {
  7386  	return apijson.UnmarshalRoot(data, r)
  7387  }
  7388  
  7389  // The properties Name, Type are required.
  7390  type BetaMemoryTool20250818Param struct {
  7391  	// If true, tool will not be included in initial system prompt. Only loaded when
  7392  	// returned via tool_reference from tool search.
  7393  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
  7394  	// When true, guarantees schema validation on tool names and inputs
  7395  	Strict param.Opt[bool] `json:"strict,omitzero"`
  7396  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
  7397  	// "code_execution_20260521".
  7398  	AllowedCallers []string `json:"allowed_callers,omitzero"`
  7399  	// Create a cache control breakpoint at this content block.
  7400  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  7401  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
  7402  	// Name of the tool.
  7403  	//
  7404  	// This is how the tool will be called by the model and in `tool_use` blocks.
  7405  	//
  7406  	// This field can be elided, and will marshal its zero value as "memory".
  7407  	Name constant.Memory `json:"name" default:"memory"`
  7408  	// This field can be elided, and will marshal its zero value as "memory_20250818".
  7409  	Type constant.Memory20250818 `json:"type" default:"memory_20250818"`
  7410  	paramObj
  7411  }
  7412  
  7413  func (r BetaMemoryTool20250818Param) MarshalJSON() (data []byte, err error) {
  7414  	type shadow BetaMemoryTool20250818Param
  7415  	return param.MarshalObject(r, (*shadow)(&r))
  7416  }
  7417  func (r *BetaMemoryTool20250818Param) UnmarshalJSON(data []byte) error {
  7418  	return apijson.UnmarshalRoot(data, r)
  7419  }
  7420  
  7421  // BetaMemoryTool20250818CommandUnion contains all possible properties and values
  7422  // from [BetaMemoryTool20250818ViewCommand], [BetaMemoryTool20250818CreateCommand],
  7423  // [BetaMemoryTool20250818StrReplaceCommand],
  7424  // [BetaMemoryTool20250818InsertCommand], [BetaMemoryTool20250818DeleteCommand],
  7425  // [BetaMemoryTool20250818RenameCommand].
  7426  //
  7427  // Use the [BetaMemoryTool20250818CommandUnion.AsAny] method to switch on the
  7428  // variant.
  7429  //
  7430  // Use the methods beginning with 'As' to cast the union to one of its variants.
  7431  type BetaMemoryTool20250818CommandUnion struct {
  7432  	// Any of "view", "create", "str_replace", "insert", "delete", "rename".
  7433  	Command string `json:"command"`
  7434  	Path    string `json:"path"`
  7435  	// This field is from variant [BetaMemoryTool20250818ViewCommand].
  7436  	ViewRange []int64 `json:"view_range"`
  7437  	// This field is from variant [BetaMemoryTool20250818CreateCommand].
  7438  	FileText string `json:"file_text"`
  7439  	// This field is from variant [BetaMemoryTool20250818StrReplaceCommand].
  7440  	NewStr string `json:"new_str"`
  7441  	// This field is from variant [BetaMemoryTool20250818StrReplaceCommand].
  7442  	OldStr string `json:"old_str"`
  7443  	// This field is from variant [BetaMemoryTool20250818InsertCommand].
  7444  	InsertLine int64 `json:"insert_line"`
  7445  	// This field is from variant [BetaMemoryTool20250818InsertCommand].
  7446  	InsertText string `json:"insert_text"`
  7447  	// This field is from variant [BetaMemoryTool20250818RenameCommand].
  7448  	NewPath string `json:"new_path"`
  7449  	// This field is from variant [BetaMemoryTool20250818RenameCommand].
  7450  	OldPath string `json:"old_path"`
  7451  	JSON    struct {
  7452  		Command    respjson.Field
  7453  		Path       respjson.Field
  7454  		ViewRange  respjson.Field
  7455  		FileText   respjson.Field
  7456  		NewStr     respjson.Field
  7457  		OldStr     respjson.Field
  7458  		InsertLine respjson.Field
  7459  		InsertText respjson.Field
  7460  		NewPath    respjson.Field
  7461  		OldPath    respjson.Field
  7462  		raw        string
  7463  	} `json:"-"`
  7464  }
  7465  
  7466  // anyBetaMemoryTool20250818Command is implemented by each variant of
  7467  // [BetaMemoryTool20250818CommandUnion] to add type safety for the return type of
  7468  // [BetaMemoryTool20250818CommandUnion.AsAny]
  7469  type anyBetaMemoryTool20250818Command interface {
  7470  	implBetaMemoryTool20250818CommandUnion()
  7471  }
  7472  
  7473  func (BetaMemoryTool20250818ViewCommand) implBetaMemoryTool20250818CommandUnion()       {}
  7474  func (BetaMemoryTool20250818CreateCommand) implBetaMemoryTool20250818CommandUnion()     {}
  7475  func (BetaMemoryTool20250818StrReplaceCommand) implBetaMemoryTool20250818CommandUnion() {}
  7476  func (BetaMemoryTool20250818InsertCommand) implBetaMemoryTool20250818CommandUnion()     {}
  7477  func (BetaMemoryTool20250818DeleteCommand) implBetaMemoryTool20250818CommandUnion()     {}
  7478  func (BetaMemoryTool20250818RenameCommand) implBetaMemoryTool20250818CommandUnion()     {}
  7479  
  7480  // Use the following switch statement to find the correct variant
  7481  //
  7482  //	switch variant := BetaMemoryTool20250818CommandUnion.AsAny().(type) {
  7483  //	case anthropic.BetaMemoryTool20250818ViewCommand:
  7484  //	case anthropic.BetaMemoryTool20250818CreateCommand:
  7485  //	case anthropic.BetaMemoryTool20250818StrReplaceCommand:
  7486  //	case anthropic.BetaMemoryTool20250818InsertCommand:
  7487  //	case anthropic.BetaMemoryTool20250818DeleteCommand:
  7488  //	case anthropic.BetaMemoryTool20250818RenameCommand:
  7489  //	default:
  7490  //	  fmt.Errorf("no variant present")
  7491  //	}
  7492  func (u BetaMemoryTool20250818CommandUnion) AsAny() anyBetaMemoryTool20250818Command {
  7493  	switch u.Command {
  7494  	case "view":
  7495  		return u.AsView()
  7496  	case "create":
  7497  		return u.AsCreate()
  7498  	case "str_replace":
  7499  		return u.AsStrReplace()
  7500  	case "insert":
  7501  		return u.AsInsert()
  7502  	case "delete":
  7503  		return u.AsDelete()
  7504  	case "rename":
  7505  		return u.AsRename()
  7506  	}
  7507  	return nil
  7508  }
  7509  
  7510  func (u BetaMemoryTool20250818CommandUnion) AsView() (v BetaMemoryTool20250818ViewCommand) {
  7511  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7512  	return
  7513  }
  7514  
  7515  func (u BetaMemoryTool20250818CommandUnion) AsCreate() (v BetaMemoryTool20250818CreateCommand) {
  7516  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7517  	return
  7518  }
  7519  
  7520  func (u BetaMemoryTool20250818CommandUnion) AsStrReplace() (v BetaMemoryTool20250818StrReplaceCommand) {
  7521  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7522  	return
  7523  }
  7524  
  7525  func (u BetaMemoryTool20250818CommandUnion) AsInsert() (v BetaMemoryTool20250818InsertCommand) {
  7526  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7527  	return
  7528  }
  7529  
  7530  func (u BetaMemoryTool20250818CommandUnion) AsDelete() (v BetaMemoryTool20250818DeleteCommand) {
  7531  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7532  	return
  7533  }
  7534  
  7535  func (u BetaMemoryTool20250818CommandUnion) AsRename() (v BetaMemoryTool20250818RenameCommand) {
  7536  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  7537  	return
  7538  }
  7539  
  7540  // Returns the unmodified JSON received from the API
  7541  func (u BetaMemoryTool20250818CommandUnion) RawJSON() string { return u.JSON.raw }
  7542  
  7543  func (r *BetaMemoryTool20250818CommandUnion) UnmarshalJSON(data []byte) error {
  7544  	return apijson.UnmarshalRoot(data, r)
  7545  }
  7546  
  7547  type BetaMemoryTool20250818CreateCommand struct {
  7548  	// Command type identifier
  7549  	Command constant.Create `json:"command" default:"create"`
  7550  	// Content to write to the file
  7551  	FileText string `json:"file_text" api:"required"`
  7552  	// Path where the file should be created
  7553  	Path string `json:"path" api:"required"`
  7554  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7555  	JSON struct {
  7556  		Command     respjson.Field
  7557  		FileText    respjson.Field
  7558  		Path        respjson.Field
  7559  		ExtraFields map[string]respjson.Field
  7560  		raw         string
  7561  	} `json:"-"`
  7562  }
  7563  
  7564  // Returns the unmodified JSON received from the API
  7565  func (r BetaMemoryTool20250818CreateCommand) RawJSON() string { return r.JSON.raw }
  7566  func (r *BetaMemoryTool20250818CreateCommand) UnmarshalJSON(data []byte) error {
  7567  	return apijson.UnmarshalRoot(data, r)
  7568  }
  7569  
  7570  type BetaMemoryTool20250818DeleteCommand struct {
  7571  	// Command type identifier
  7572  	Command constant.Delete `json:"command" default:"delete"`
  7573  	// Path to the file or directory to delete
  7574  	Path string `json:"path" api:"required"`
  7575  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7576  	JSON struct {
  7577  		Command     respjson.Field
  7578  		Path        respjson.Field
  7579  		ExtraFields map[string]respjson.Field
  7580  		raw         string
  7581  	} `json:"-"`
  7582  }
  7583  
  7584  // Returns the unmodified JSON received from the API
  7585  func (r BetaMemoryTool20250818DeleteCommand) RawJSON() string { return r.JSON.raw }
  7586  func (r *BetaMemoryTool20250818DeleteCommand) UnmarshalJSON(data []byte) error {
  7587  	return apijson.UnmarshalRoot(data, r)
  7588  }
  7589  
  7590  type BetaMemoryTool20250818InsertCommand struct {
  7591  	// Command type identifier
  7592  	Command constant.Insert `json:"command" default:"insert"`
  7593  	// Line number where text should be inserted
  7594  	InsertLine int64 `json:"insert_line" api:"required"`
  7595  	// Text to insert at the specified line
  7596  	InsertText string `json:"insert_text" api:"required"`
  7597  	// Path to the file where text should be inserted
  7598  	Path string `json:"path" api:"required"`
  7599  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7600  	JSON struct {
  7601  		Command     respjson.Field
  7602  		InsertLine  respjson.Field
  7603  		InsertText  respjson.Field
  7604  		Path        respjson.Field
  7605  		ExtraFields map[string]respjson.Field
  7606  		raw         string
  7607  	} `json:"-"`
  7608  }
  7609  
  7610  // Returns the unmodified JSON received from the API
  7611  func (r BetaMemoryTool20250818InsertCommand) RawJSON() string { return r.JSON.raw }
  7612  func (r *BetaMemoryTool20250818InsertCommand) UnmarshalJSON(data []byte) error {
  7613  	return apijson.UnmarshalRoot(data, r)
  7614  }
  7615  
  7616  type BetaMemoryTool20250818RenameCommand struct {
  7617  	// Command type identifier
  7618  	Command constant.Rename `json:"command" default:"rename"`
  7619  	// New path for the file or directory
  7620  	NewPath string `json:"new_path" api:"required"`
  7621  	// Current path of the file or directory
  7622  	OldPath string `json:"old_path" api:"required"`
  7623  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7624  	JSON struct {
  7625  		Command     respjson.Field
  7626  		NewPath     respjson.Field
  7627  		OldPath     respjson.Field
  7628  		ExtraFields map[string]respjson.Field
  7629  		raw         string
  7630  	} `json:"-"`
  7631  }
  7632  
  7633  // Returns the unmodified JSON received from the API
  7634  func (r BetaMemoryTool20250818RenameCommand) RawJSON() string { return r.JSON.raw }
  7635  func (r *BetaMemoryTool20250818RenameCommand) UnmarshalJSON(data []byte) error {
  7636  	return apijson.UnmarshalRoot(data, r)
  7637  }
  7638  
  7639  type BetaMemoryTool20250818StrReplaceCommand struct {
  7640  	// Command type identifier
  7641  	Command constant.StrReplace `json:"command" default:"str_replace"`
  7642  	// Text to replace with
  7643  	NewStr string `json:"new_str" api:"required"`
  7644  	// Text to search for and replace
  7645  	OldStr string `json:"old_str" api:"required"`
  7646  	// Path to the file where text should be replaced
  7647  	Path string `json:"path" api:"required"`
  7648  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7649  	JSON struct {
  7650  		Command     respjson.Field
  7651  		NewStr      respjson.Field
  7652  		OldStr      respjson.Field
  7653  		Path        respjson.Field
  7654  		ExtraFields map[string]respjson.Field
  7655  		raw         string
  7656  	} `json:"-"`
  7657  }
  7658  
  7659  // Returns the unmodified JSON received from the API
  7660  func (r BetaMemoryTool20250818StrReplaceCommand) RawJSON() string { return r.JSON.raw }
  7661  func (r *BetaMemoryTool20250818StrReplaceCommand) UnmarshalJSON(data []byte) error {
  7662  	return apijson.UnmarshalRoot(data, r)
  7663  }
  7664  
  7665  type BetaMemoryTool20250818ViewCommand struct {
  7666  	// Command type identifier
  7667  	Command constant.View `json:"command" default:"view"`
  7668  	// Path to directory or file to view
  7669  	Path string `json:"path" api:"required"`
  7670  	// Optional line range for viewing specific lines
  7671  	ViewRange []int64 `json:"view_range"`
  7672  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7673  	JSON struct {
  7674  		Command     respjson.Field
  7675  		Path        respjson.Field
  7676  		ViewRange   respjson.Field
  7677  		ExtraFields map[string]respjson.Field
  7678  		raw         string
  7679  	} `json:"-"`
  7680  }
  7681  
  7682  // Returns the unmodified JSON received from the API
  7683  func (r BetaMemoryTool20250818ViewCommand) RawJSON() string { return r.JSON.raw }
  7684  func (r *BetaMemoryTool20250818ViewCommand) UnmarshalJSON(data []byte) error {
  7685  	return apijson.UnmarshalRoot(data, r)
  7686  }
  7687  
  7688  type BetaMessage struct {
  7689  	// Unique object identifier.
  7690  	//
  7691  	// The format and length of IDs may change over time.
  7692  	ID string `json:"id" api:"required"`
  7693  	// Information about the container used in the request (for the code execution
  7694  	// tool)
  7695  	Container BetaContainer `json:"container" api:"required"`
  7696  	// Content generated by the model.
  7697  	//
  7698  	// This is an array of content blocks, each of which has a `type` that determines
  7699  	// its shape.
  7700  	//
  7701  	// Example:
  7702  	//
  7703  	// ```json
  7704  	// [{ "type": "text", "text": "Hi, I'm Claude." }]
  7705  	// ```
  7706  	//
  7707  	// If the request input `messages` ended with an `assistant` turn, then the
  7708  	// response `content` will continue directly from that last turn. You can use this
  7709  	// to constrain the model's output.
  7710  	//
  7711  	// For example, if the input `messages` were:
  7712  	//
  7713  	// ```json
  7714  	// [
  7715  	//
  7716  	//	{
  7717  	//	  "role": "user",
  7718  	//	  "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
  7719  	//	},
  7720  	//	{ "role": "assistant", "content": "The best answer is (" }
  7721  	//
  7722  	// ]
  7723  	// ```
  7724  	//
  7725  	// Then the response `content` might be:
  7726  	//
  7727  	// ```json
  7728  	// [{ "type": "text", "text": "B)" }]
  7729  	// ```
  7730  	Content []BetaContentBlockUnion `json:"content" api:"required"`
  7731  	// Context management response.
  7732  	//
  7733  	// Information about context management strategies applied during the request.
  7734  	ContextManagement BetaContextManagementResponse `json:"context_management" api:"required"`
  7735  	// Response envelope for request-level diagnostics. Present (possibly null)
  7736  	// whenever the caller supplied `diagnostics` on the request.
  7737  	Diagnostics BetaDiagnostics `json:"diagnostics" api:"required"`
  7738  	// The model that will complete your prompt.
  7739  	//
  7740  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
  7741  	// details and options.
  7742  	Model Model `json:"model" api:"required"`
  7743  	// Conversational role of the generated message.
  7744  	//
  7745  	// This will always be `"assistant"`.
  7746  	Role constant.Assistant `json:"role" default:"assistant"`
  7747  	// Structured information about a refusal.
  7748  	StopDetails BetaRefusalStopDetails `json:"stop_details" api:"required"`
  7749  	// The reason that we stopped.
  7750  	//
  7751  	// This may be one the following values:
  7752  	//
  7753  	//   - `"end_turn"`: the model reached a natural stopping point
  7754  	//   - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
  7755  	//   - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
  7756  	//   - `"tool_use"`: the model invoked one or more tools
  7757  	//   - `"pause_turn"`: we paused a long-running turn. You may provide the response
  7758  	//     back as-is in a subsequent request to let the model continue.
  7759  	//   - `"refusal"`: when streaming classifiers intervene to handle potential policy
  7760  	//     violations
  7761  	//   - `"model_context_window_exceeded"`: we exceeded the model's context window
  7762  	//
  7763  	// In non-streaming mode this value is always non-null. In streaming mode, it is
  7764  	// null in the `message_start` event and non-null otherwise.
  7765  	//
  7766  	// Any of "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn",
  7767  	// "compaction", "refusal", "model_context_window_exceeded".
  7768  	StopReason BetaStopReason `json:"stop_reason" api:"required"`
  7769  	// Which custom stop sequence was generated, if any.
  7770  	//
  7771  	// This value will be a non-null string if one of your custom stop sequences was
  7772  	// generated.
  7773  	StopSequence string `json:"stop_sequence" api:"required"`
  7774  	// Object type.
  7775  	//
  7776  	// For Messages, this is always `"message"`.
  7777  	Type constant.Message `json:"type" default:"message"`
  7778  	// Billing and rate-limit usage.
  7779  	//
  7780  	// Anthropic's API bills and rate-limits by token counts, as tokens represent the
  7781  	// underlying cost to our systems.
  7782  	//
  7783  	// Under the hood, the API transforms requests into a format suitable for the
  7784  	// model. The model's output then goes through a parsing stage before becoming an
  7785  	// API response. As a result, the token counts in `usage` will not match one-to-one
  7786  	// with the exact visible content of an API request or response.
  7787  	//
  7788  	// For example, `output_tokens` will be non-zero, even for an empty string response
  7789  	// from Claude.
  7790  	//
  7791  	// Total input tokens in a request is the summation of `input_tokens`,
  7792  	// `cache_creation_input_tokens`, and `cache_read_input_tokens`.
  7793  	Usage BetaUsage `json:"usage" api:"required"`
  7794  	// Changes the API made to the request's input before showing it to the model: one
  7795  	// entry per change, in request order. Today the only entry type is
  7796  	// `thinking_dropped` — a `thinking`, `redacted_thinking` or `connector_text` block
  7797  	// from the request's `messages` that was removed from the prompt instead of being
  7798  	// shown to the model because it failed a binding check. More entry types may be
  7799  	// added over time; ignore types you do not recognize.
  7800  	//
  7801  	// Requires `anthropic-beta: thinking-binding-controls-2026-08-01`. Present on
  7802  	// every such response from a model that supports extended thinking, as `[]` when
  7803  	// nothing was changed; without the beta, blocks are removed all the same but
  7804  	// nothing is reported. Removed blocks contribute nothing to `usage.input_tokens`.
  7805  	// When streaming, the array is final in `message_start`; the final `message_delta`
  7806  	// event carries it only when a server-side model fallback happened mid-stream, in
  7807  	// which case it holds the serving model's entries and replaces the one in
  7808  	// `message_start`.
  7809  	InputTransformations []BetaThinkingDroppedInputTransformation `json:"input_transformations" api:"nullable"`
  7810  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7811  	JSON struct {
  7812  		ID                   respjson.Field
  7813  		Container            respjson.Field
  7814  		Content              respjson.Field
  7815  		ContextManagement    respjson.Field
  7816  		Diagnostics          respjson.Field
  7817  		Model                respjson.Field
  7818  		Role                 respjson.Field
  7819  		StopDetails          respjson.Field
  7820  		StopReason           respjson.Field
  7821  		StopSequence         respjson.Field
  7822  		Type                 respjson.Field
  7823  		Usage                respjson.Field
  7824  		InputTransformations respjson.Field
  7825  		ExtraFields          map[string]respjson.Field
  7826  		raw                  string
  7827  	} `json:"-"`
  7828  }
  7829  
  7830  // Returns the unmodified JSON received from the API
  7831  func (r BetaMessage) RawJSON() string { return r.JSON.raw }
  7832  func (r *BetaMessage) UnmarshalJSON(data []byte) error {
  7833  	return apijson.UnmarshalRoot(data, r)
  7834  }
  7835  
  7836  type BetaMessageDeltaUsage struct {
  7837  	// The cumulative number of input tokens used to create the cache entry.
  7838  	CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
  7839  	// The cumulative number of input tokens read from the cache.
  7840  	CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
  7841  	// Outcome of the `fallback_credit_token` presented on this request.
  7842  	FallbackCredit BetaFallbackCreditUsage `json:"fallback_credit" api:"required"`
  7843  	// The cumulative number of input tokens which were used.
  7844  	InputTokens int64 `json:"input_tokens" api:"required"`
  7845  	// Per-iteration token usage breakdown.
  7846  	//
  7847  	// Each entry represents one sampling iteration, with its own input/output token
  7848  	// counts and cache statistics, discriminated by `type`. For `message` entries
  7849  	// (model sampling iterations, such as the turns of a server-side tool use loop),
  7850  	// this allows you to:
  7851  	//
  7852  	// - Determine which iterations exceeded long context thresholds (>=200k tokens)
  7853  	// - Calculate the context window size from the last `message` entry
  7854  	// - Understand token accumulation across server-side tool use loops
  7855  	//
  7856  	// A `compaction` entry reports the token usage of the compaction operation itself
  7857  	// — the server-side request that summarizes the context being closed — NOT the
  7858  	// size of the context that was compacted away, and its token counts can be much
  7859  	// smaller than that closed context (for example, a compaction that closes a
  7860  	// ~200k-token context can report only a few thousand tokens). Do not derive the
  7861  	// context window size from a `compaction` entry, even when it is the last entry. A
  7862  	// `compaction` entry's tokens are not included in the top-level `usage` fields.
  7863  	// When an input-token trigger is in effect (the default — 150,000 tokens unless
  7864  	// configured otherwise), each `compaction` entry closes a context that had reached
  7865  	// at least that threshold, though the context can exceed it by the final
  7866  	// iteration's output and tool results.
  7867  	Iterations BetaIterationsUsage `json:"iterations" api:"required"`
  7868  	// The cumulative number of output tokens which were used.
  7869  	OutputTokens int64 `json:"output_tokens" api:"required"`
  7870  	// Breakdown of output tokens by category.
  7871  	//
  7872  	// `output_tokens` remains the inclusive, authoritative total used for billing.
  7873  	// This object provides a read-only decomposition for observability — for example,
  7874  	// how many of the billed output tokens were spent on internal reasoning that may
  7875  	// have been summarized before being returned to you.
  7876  	OutputTokensDetails BetaOutputTokensDetails `json:"output_tokens_details" api:"required"`
  7877  	// The number of server tool requests.
  7878  	ServerToolUse BetaServerToolUsage `json:"server_tool_use" api:"required"`
  7879  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7880  	JSON struct {
  7881  		CacheCreationInputTokens respjson.Field
  7882  		CacheReadInputTokens     respjson.Field
  7883  		FallbackCredit           respjson.Field
  7884  		InputTokens              respjson.Field
  7885  		Iterations               respjson.Field
  7886  		OutputTokens             respjson.Field
  7887  		OutputTokensDetails      respjson.Field
  7888  		ServerToolUse            respjson.Field
  7889  		ExtraFields              map[string]respjson.Field
  7890  		raw                      string
  7891  	} `json:"-"`
  7892  }
  7893  
  7894  // Returns the unmodified JSON received from the API
  7895  func (r BetaMessageDeltaUsage) RawJSON() string { return r.JSON.raw }
  7896  func (r *BetaMessageDeltaUsage) UnmarshalJSON(data []byte) error {
  7897  	return apijson.UnmarshalRoot(data, r)
  7898  }
  7899  
  7900  // Token usage for a sampling iteration.
  7901  type BetaMessageIterationUsage struct {
  7902  	// Breakdown of cached tokens by TTL
  7903  	CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
  7904  	// The number of input tokens used to create the cache entry.
  7905  	CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
  7906  	// The number of input tokens read from the cache.
  7907  	CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
  7908  	// The number of input tokens which were used.
  7909  	InputTokens int64 `json:"input_tokens" api:"required"`
  7910  	// The model that will complete your prompt.
  7911  	//
  7912  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
  7913  	// details and options.
  7914  	Model Model `json:"model" api:"required"`
  7915  	// The number of output tokens which were used.
  7916  	OutputTokens int64 `json:"output_tokens" api:"required"`
  7917  	// Usage for a sampling iteration
  7918  	Type constant.Message `json:"type" default:"message"`
  7919  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  7920  	JSON struct {
  7921  		CacheCreation            respjson.Field
  7922  		CacheCreationInputTokens respjson.Field
  7923  		CacheReadInputTokens     respjson.Field
  7924  		InputTokens              respjson.Field
  7925  		Model                    respjson.Field
  7926  		OutputTokens             respjson.Field
  7927  		Type                     respjson.Field
  7928  		ExtraFields              map[string]respjson.Field
  7929  		raw                      string
  7930  	} `json:"-"`
  7931  }
  7932  
  7933  // Returns the unmodified JSON received from the API
  7934  func (r BetaMessageIterationUsage) RawJSON() string { return r.JSON.raw }
  7935  func (r *BetaMessageIterationUsage) UnmarshalJSON(data []byte) error {
  7936  	return apijson.UnmarshalRoot(data, r)
  7937  }
  7938  
  7939  // The properties Content, Role are required.
  7940  type BetaMessageParam struct {
  7941  	Content []BetaContentBlockParamUnion `json:"content,omitzero" api:"required"`
  7942  	// Any of "user", "assistant", "system".
  7943  	Role BetaMessageParamRole `json:"role,omitzero" api:"required"`
  7944  	// How long this system message's text stays in front of the model. `"never"` (the
  7945  	// default) renders it on every request that includes it. `"next_user_message"`
  7946  	// renders it only for the user turn it follows: once a later `role: "user"`
  7947  	// message exists in `messages` the message stays in the array (send it unchanged)
  7948  	// but is no longer shown to the model. Only permitted on `role: "system"`
  7949  	// messages.
  7950  	//
  7951  	// Any of "next_user_message", "never".
  7952  	ClearAt BetaMessageParamClearAt `json:"clear_at,omitzero"`
  7953  	// Per-message output configuration on a role:"system" input message.
  7954  	//
  7955  	// Fields here apply per-turn; `format` remains top-level only. An empty `{}` is
  7956  	// accepted on a message that carries content; a message with neither content nor
  7957  	// output_config fields is rejected.
  7958  	OutputConfig BetaSystemMessageOutputConfigParam `json:"output_config,omitzero"`
  7959  	paramObj
  7960  }
  7961  
  7962  func NewBetaUserMessage(blocks ...BetaContentBlockParamUnion) BetaMessageParam {
  7963  	return BetaMessageParam{
  7964  		Role:    BetaMessageParamRoleUser,
  7965  		Content: blocks,
  7966  	}
  7967  }
  7968  
  7969  // NewBetaSystemMessage builds a role:"system" message carrying a per-message
  7970  // output config. `content` is required on the wire, so nil becomes an empty slice.
  7971  func NewBetaSystemMessage(outputConfig BetaSystemMessageOutputConfigParam, blocks ...BetaContentBlockParamUnion) BetaMessageParam {
  7972  	if blocks == nil {
  7973  		blocks = []BetaContentBlockParamUnion{}
  7974  	}
  7975  	return BetaMessageParam{
  7976  		Role:         BetaMessageParamRoleSystem,
  7977  		Content:      blocks,
  7978  		OutputConfig: outputConfig,
  7979  	}
  7980  }
  7981  
  7982  func (r BetaMessageParam) MarshalJSON() (data []byte, err error) {
  7983  	type shadow BetaMessageParam
  7984  	return param.MarshalObject(r, (*shadow)(&r))
  7985  }
  7986  func (r *BetaMessageParam) UnmarshalJSON(data []byte) error {
  7987  	return apijson.UnmarshalRoot(data, r)
  7988  }
  7989  
  7990  type BetaMessageParamRole string
  7991  
  7992  const (
  7993  	BetaMessageParamRoleUser      BetaMessageParamRole = "user"
  7994  	BetaMessageParamRoleAssistant BetaMessageParamRole = "assistant"
  7995  	BetaMessageParamRoleSystem    BetaMessageParamRole = "system"
  7996  )
  7997  
  7998  // How long this system message's text stays in front of the model. `"never"` (the
  7999  // default) renders it on every request that includes it. `"next_user_message"`
  8000  // renders it only for the user turn it follows: once a later `role: "user"`
  8001  // message exists in `messages` the message stays in the array (send it unchanged)
  8002  // but is no longer shown to the model. Only permitted on `role: "system"`
  8003  // messages.
  8004  type BetaMessageParamClearAt string
  8005  
  8006  const (
  8007  	BetaMessageParamClearAtNextUserMessage BetaMessageParamClearAt = "next_user_message"
  8008  	BetaMessageParamClearAtNever           BetaMessageParamClearAt = "never"
  8009  )
  8010  
  8011  type BetaMessageTokensCount struct {
  8012  	// Information about context management applied to the message.
  8013  	ContextManagement BetaCountTokensContextManagementResponse `json:"context_management" api:"required"`
  8014  	// The total number of tokens across the provided list of messages, system prompt,
  8015  	// and tools.
  8016  	InputTokens int64 `json:"input_tokens" api:"required"`
  8017  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8018  	JSON struct {
  8019  		ContextManagement respjson.Field
  8020  		InputTokens       respjson.Field
  8021  		ExtraFields       map[string]respjson.Field
  8022  		raw               string
  8023  	} `json:"-"`
  8024  }
  8025  
  8026  // Returns the unmodified JSON received from the API
  8027  func (r BetaMessageTokensCount) RawJSON() string { return r.JSON.raw }
  8028  func (r *BetaMessageTokensCount) UnmarshalJSON(data []byte) error {
  8029  	return apijson.UnmarshalRoot(data, r)
  8030  }
  8031  
  8032  type BetaMetadataParam struct {
  8033  	// An external identifier for the user who is associated with the request.
  8034  	//
  8035  	// This should be a uuid, hash value, or other opaque identifier. Anthropic may use
  8036  	// this id to help detect abuse. Do not include any identifying information such as
  8037  	// name, email address, or phone number.
  8038  	UserID param.Opt[string] `json:"user_id,omitzero"`
  8039  	paramObj
  8040  }
  8041  
  8042  func (r BetaMetadataParam) MarshalJSON() (data []byte, err error) {
  8043  	type shadow BetaMetadataParam
  8044  	return param.MarshalObject(r, (*shadow)(&r))
  8045  }
  8046  func (r *BetaMetadataParam) UnmarshalJSON(data []byte) error {
  8047  	return apijson.UnmarshalRoot(data, r)
  8048  }
  8049  
  8050  type BetaOutputConfigParam struct {
  8051  	// All possible effort levels.
  8052  	//
  8053  	// Any of "low", "medium", "high", "xhigh", "max".
  8054  	Effort BetaOutputConfigEffort `json:"effort,omitzero"`
  8055  	// A schema to specify Claude's output format in responses. See
  8056  	// [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
  8057  	Format BetaJSONOutputFormatParam `json:"format,omitzero"`
  8058  	// User-configurable total token budget across contexts.
  8059  	TaskBudget BetaTokenTaskBudgetParam `json:"task_budget,omitzero"`
  8060  	paramObj
  8061  }
  8062  
  8063  func (r BetaOutputConfigParam) MarshalJSON() (data []byte, err error) {
  8064  	type shadow BetaOutputConfigParam
  8065  	return param.MarshalObject(r, (*shadow)(&r))
  8066  }
  8067  func (r *BetaOutputConfigParam) UnmarshalJSON(data []byte) error {
  8068  	return apijson.UnmarshalRoot(data, r)
  8069  }
  8070  
  8071  // All possible effort levels.
  8072  type BetaOutputConfigEffort string
  8073  
  8074  const (
  8075  	BetaOutputConfigEffortLow    BetaOutputConfigEffort = "low"
  8076  	BetaOutputConfigEffortMedium BetaOutputConfigEffort = "medium"
  8077  	BetaOutputConfigEffortHigh   BetaOutputConfigEffort = "high"
  8078  	BetaOutputConfigEffortXhigh  BetaOutputConfigEffort = "xhigh"
  8079  	BetaOutputConfigEffortMax    BetaOutputConfigEffort = "max"
  8080  )
  8081  
  8082  type BetaOutputTokensDetails struct {
  8083  	// Number of output tokens the model generated as internal reasoning, including the
  8084  	// thinking-block delimiter tokens.
  8085  	//
  8086  	// Reflects the raw reasoning the model produced, not the (possibly shorter)
  8087  	// summarized thinking text returned in the response body. Computed by
  8088  	// re-tokenizing the raw reasoning text, so it may differ from the model's exact
  8089  	// generation count by a small number of tokens. Always ≤ `output_tokens`;
  8090  	// `output_tokens - thinking_tokens` approximates the non-reasoning output.
  8091  	ThinkingTokens int64 `json:"thinking_tokens" api:"required"`
  8092  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8093  	JSON struct {
  8094  		ThinkingTokens respjson.Field
  8095  		ExtraFields    map[string]respjson.Field
  8096  		raw            string
  8097  	} `json:"-"`
  8098  }
  8099  
  8100  // Returns the unmodified JSON received from the API
  8101  func (r BetaOutputTokensDetails) RawJSON() string { return r.JSON.raw }
  8102  func (r *BetaOutputTokensDetails) UnmarshalJSON(data []byte) error {
  8103  	return apijson.UnmarshalRoot(data, r)
  8104  }
  8105  
  8106  type BetaPlainTextSource struct {
  8107  	Data      string             `json:"data" api:"required"`
  8108  	MediaType constant.TextPlain `json:"media_type" default:"text/plain"`
  8109  	Type      constant.Text      `json:"type" default:"text"`
  8110  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8111  	JSON struct {
  8112  		Data        respjson.Field
  8113  		MediaType   respjson.Field
  8114  		Type        respjson.Field
  8115  		ExtraFields map[string]respjson.Field
  8116  		raw         string
  8117  	} `json:"-"`
  8118  }
  8119  
  8120  // Returns the unmodified JSON received from the API
  8121  func (r BetaPlainTextSource) RawJSON() string { return r.JSON.raw }
  8122  func (r *BetaPlainTextSource) UnmarshalJSON(data []byte) error {
  8123  	return apijson.UnmarshalRoot(data, r)
  8124  }
  8125  
  8126  // ToParam converts this BetaPlainTextSource to a BetaPlainTextSourceParam.
  8127  //
  8128  // Warning: the fields of the param type will not be present. ToParam should only
  8129  // be used at the last possible moment before sending a request. Test for this with
  8130  // BetaPlainTextSourceParam.Overrides()
  8131  func (r BetaPlainTextSource) ToParam() BetaPlainTextSourceParam {
  8132  	return param.Override[BetaPlainTextSourceParam](json.RawMessage(r.RawJSON()))
  8133  }
  8134  
  8135  // The properties Data, MediaType, Type are required.
  8136  type BetaPlainTextSourceParam struct {
  8137  	Data string `json:"data" api:"required"`
  8138  	// This field can be elided, and will marshal its zero value as "text/plain".
  8139  	MediaType constant.TextPlain `json:"media_type" default:"text/plain"`
  8140  	// This field can be elided, and will marshal its zero value as "text".
  8141  	Type constant.Text `json:"type" default:"text"`
  8142  	paramObj
  8143  }
  8144  
  8145  func (r BetaPlainTextSourceParam) MarshalJSON() (data []byte, err error) {
  8146  	type shadow BetaPlainTextSourceParam
  8147  	return param.MarshalObject(r, (*shadow)(&r))
  8148  }
  8149  func (r *BetaPlainTextSourceParam) UnmarshalJSON(data []byte) error {
  8150  	return apijson.UnmarshalRoot(data, r)
  8151  }
  8152  
  8153  // BetaRawContentBlockDeltaUnion contains all possible properties and values from
  8154  // [BetaTextDelta], [BetaInputJSONDelta], [BetaCitationsDelta],
  8155  // [BetaThinkingDelta], [BetaSignatureDelta], [BetaCompactionContentBlockDelta].
  8156  //
  8157  // Use the [BetaRawContentBlockDeltaUnion.AsAny] method to switch on the variant.
  8158  //
  8159  // Use the methods beginning with 'As' to cast the union to one of its variants.
  8160  type BetaRawContentBlockDeltaUnion struct {
  8161  	// This field is from variant [BetaTextDelta].
  8162  	Text string `json:"text"`
  8163  	// Any of "text_delta", "input_json_delta", "citations_delta", "thinking_delta",
  8164  	// "signature_delta", "compaction_delta".
  8165  	Type string `json:"type"`
  8166  	// This field is from variant [BetaInputJSONDelta].
  8167  	PartialJSON string `json:"partial_json"`
  8168  	// This field is from variant [BetaCitationsDelta].
  8169  	Citation BetaCitationsDeltaCitationUnion `json:"citation"`
  8170  	// This field is from variant [BetaThinkingDelta].
  8171  	EstimatedTokens int64 `json:"estimated_tokens"`
  8172  	// This field is from variant [BetaThinkingDelta].
  8173  	Thinking string `json:"thinking"`
  8174  	// This field is from variant [BetaSignatureDelta].
  8175  	Signature string `json:"signature"`
  8176  	// This field is from variant [BetaCompactionContentBlockDelta].
  8177  	Content string `json:"content"`
  8178  	// This field is from variant [BetaCompactionContentBlockDelta].
  8179  	EncryptedContent string `json:"encrypted_content"`
  8180  	JSON             struct {
  8181  		Text             respjson.Field
  8182  		Type             respjson.Field
  8183  		PartialJSON      respjson.Field
  8184  		Citation         respjson.Field
  8185  		EstimatedTokens  respjson.Field
  8186  		Thinking         respjson.Field
  8187  		Signature        respjson.Field
  8188  		Content          respjson.Field
  8189  		EncryptedContent respjson.Field
  8190  		raw              string
  8191  	} `json:"-"`
  8192  }
  8193  
  8194  // anyBetaRawContentBlockDelta is implemented by each variant of
  8195  // [BetaRawContentBlockDeltaUnion] to add type safety for the return type of
  8196  // [BetaRawContentBlockDeltaUnion.AsAny]
  8197  type anyBetaRawContentBlockDelta interface {
  8198  	implBetaRawContentBlockDeltaUnion()
  8199  }
  8200  
  8201  func (BetaTextDelta) implBetaRawContentBlockDeltaUnion()                   {}
  8202  func (BetaInputJSONDelta) implBetaRawContentBlockDeltaUnion()              {}
  8203  func (BetaCitationsDelta) implBetaRawContentBlockDeltaUnion()              {}
  8204  func (BetaThinkingDelta) implBetaRawContentBlockDeltaUnion()               {}
  8205  func (BetaSignatureDelta) implBetaRawContentBlockDeltaUnion()              {}
  8206  func (BetaCompactionContentBlockDelta) implBetaRawContentBlockDeltaUnion() {}
  8207  
  8208  // Use the following switch statement to find the correct variant
  8209  //
  8210  //	switch variant := BetaRawContentBlockDeltaUnion.AsAny().(type) {
  8211  //	case anthropic.BetaTextDelta:
  8212  //	case anthropic.BetaInputJSONDelta:
  8213  //	case anthropic.BetaCitationsDelta:
  8214  //	case anthropic.BetaThinkingDelta:
  8215  //	case anthropic.BetaSignatureDelta:
  8216  //	case anthropic.BetaCompactionContentBlockDelta:
  8217  //	default:
  8218  //	  fmt.Errorf("no variant present")
  8219  //	}
  8220  func (u BetaRawContentBlockDeltaUnion) AsAny() anyBetaRawContentBlockDelta {
  8221  	switch u.Type {
  8222  	case "text_delta":
  8223  		return u.AsTextDelta()
  8224  	case "input_json_delta":
  8225  		return u.AsInputJSONDelta()
  8226  	case "citations_delta":
  8227  		return u.AsCitationsDelta()
  8228  	case "thinking_delta":
  8229  		return u.AsThinkingDelta()
  8230  	case "signature_delta":
  8231  		return u.AsSignatureDelta()
  8232  	case "compaction_delta":
  8233  		return u.AsCompactionDelta()
  8234  	}
  8235  	return nil
  8236  }
  8237  
  8238  func (u BetaRawContentBlockDeltaUnion) AsTextDelta() (v BetaTextDelta) {
  8239  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8240  	return
  8241  }
  8242  
  8243  func (u BetaRawContentBlockDeltaUnion) AsInputJSONDelta() (v BetaInputJSONDelta) {
  8244  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8245  	return
  8246  }
  8247  
  8248  func (u BetaRawContentBlockDeltaUnion) AsCitationsDelta() (v BetaCitationsDelta) {
  8249  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8250  	return
  8251  }
  8252  
  8253  func (u BetaRawContentBlockDeltaUnion) AsThinkingDelta() (v BetaThinkingDelta) {
  8254  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8255  	return
  8256  }
  8257  
  8258  func (u BetaRawContentBlockDeltaUnion) AsSignatureDelta() (v BetaSignatureDelta) {
  8259  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8260  	return
  8261  }
  8262  
  8263  func (u BetaRawContentBlockDeltaUnion) AsCompactionDelta() (v BetaCompactionContentBlockDelta) {
  8264  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8265  	return
  8266  }
  8267  
  8268  // Returns the unmodified JSON received from the API
  8269  func (u BetaRawContentBlockDeltaUnion) RawJSON() string { return u.JSON.raw }
  8270  
  8271  func (r *BetaRawContentBlockDeltaUnion) UnmarshalJSON(data []byte) error {
  8272  	return apijson.UnmarshalRoot(data, r)
  8273  }
  8274  
  8275  type BetaRawContentBlockDeltaEvent struct {
  8276  	Delta BetaRawContentBlockDeltaUnion `json:"delta" api:"required"`
  8277  	Index int64                         `json:"index" api:"required"`
  8278  	Type  constant.ContentBlockDelta    `json:"type" default:"content_block_delta"`
  8279  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8280  	JSON struct {
  8281  		Delta       respjson.Field
  8282  		Index       respjson.Field
  8283  		Type        respjson.Field
  8284  		ExtraFields map[string]respjson.Field
  8285  		raw         string
  8286  	} `json:"-"`
  8287  }
  8288  
  8289  // Returns the unmodified JSON received from the API
  8290  func (r BetaRawContentBlockDeltaEvent) RawJSON() string { return r.JSON.raw }
  8291  func (r *BetaRawContentBlockDeltaEvent) UnmarshalJSON(data []byte) error {
  8292  	return apijson.UnmarshalRoot(data, r)
  8293  }
  8294  
  8295  type BetaRawContentBlockStartEvent struct {
  8296  	// Response model for a file uploaded to the container.
  8297  	ContentBlock BetaRawContentBlockStartEventContentBlockUnion `json:"content_block" api:"required"`
  8298  	Index        int64                                          `json:"index" api:"required"`
  8299  	Type         constant.ContentBlockStart                     `json:"type" default:"content_block_start"`
  8300  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8301  	JSON struct {
  8302  		ContentBlock respjson.Field
  8303  		Index        respjson.Field
  8304  		Type         respjson.Field
  8305  		ExtraFields  map[string]respjson.Field
  8306  		raw          string
  8307  	} `json:"-"`
  8308  }
  8309  
  8310  // Returns the unmodified JSON received from the API
  8311  func (r BetaRawContentBlockStartEvent) RawJSON() string { return r.JSON.raw }
  8312  func (r *BetaRawContentBlockStartEvent) UnmarshalJSON(data []byte) error {
  8313  	return apijson.UnmarshalRoot(data, r)
  8314  }
  8315  
  8316  // BetaRawContentBlockStartEventContentBlockUnion contains all possible properties
  8317  // and values from [BetaTextBlock], [BetaThinkingBlock],
  8318  // [BetaRedactedThinkingBlock], [BetaToolUseBlock], [BetaServerToolUseBlock],
  8319  // [BetaWebSearchToolResultBlock], [BetaWebFetchToolResultBlock],
  8320  // [BetaAdvisorToolResultBlock], [BetaCodeExecutionToolResultBlock],
  8321  // [BetaBashCodeExecutionToolResultBlock],
  8322  // [BetaTextEditorCodeExecutionToolResultBlock], [BetaToolSearchToolResultBlock],
  8323  // [BetaMCPToolUseBlock], [BetaMCPToolResultBlock], [BetaContainerUploadBlock],
  8324  // [BetaCompactionBlock], [BetaFallbackBlock].
  8325  //
  8326  // Use the [BetaRawContentBlockStartEventContentBlockUnion.AsAny] method to switch
  8327  // on the variant.
  8328  //
  8329  // Use the methods beginning with 'As' to cast the union to one of its variants.
  8330  type BetaRawContentBlockStartEventContentBlockUnion struct {
  8331  	// This field is from variant [BetaTextBlock].
  8332  	Citations []BetaTextCitationUnion `json:"citations"`
  8333  	// This field is from variant [BetaTextBlock].
  8334  	Text string `json:"text"`
  8335  	// Any of "text", "thinking", "redacted_thinking", "tool_use", "server_tool_use",
  8336  	// "web_search_tool_result", "web_fetch_tool_result", "advisor_tool_result",
  8337  	// "code_execution_tool_result", "bash_code_execution_tool_result",
  8338  	// "text_editor_code_execution_tool_result", "tool_search_tool_result",
  8339  	// "mcp_tool_use", "mcp_tool_result", "container_upload", "compaction", "fallback".
  8340  	Type string `json:"type"`
  8341  	// This field is from variant [BetaThinkingBlock].
  8342  	Signature string `json:"signature"`
  8343  	// This field is from variant [BetaThinkingBlock].
  8344  	Thinking string `json:"thinking"`
  8345  	// This field is from variant [BetaRedactedThinkingBlock].
  8346  	Data  string `json:"data"`
  8347  	ID    string `json:"id"`
  8348  	Input any    `json:"input"`
  8349  	Name  string `json:"name"`
  8350  	// This field is a union of [BetaToolUseBlockCallerUnion],
  8351  	// [BetaServerToolUseBlockCallerUnion], [BetaWebSearchToolResultBlockCallerUnion],
  8352  	// [BetaWebFetchToolResultBlockCallerUnion]
  8353  	Caller BetaRawContentBlockStartEventContentBlockUnionCaller `json:"caller"`
  8354  	// This field is from variant [BetaToolUseBlock].
  8355  	ToolsetName string `json:"toolset_name"`
  8356  	// This field is a union of [BetaWebSearchToolResultBlockContentUnion],
  8357  	// [BetaWebFetchToolResultBlockContentUnion],
  8358  	// [BetaAdvisorToolResultBlockContentUnion],
  8359  	// [BetaCodeExecutionToolResultBlockContentUnion],
  8360  	// [BetaBashCodeExecutionToolResultBlockContentUnion],
  8361  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion],
  8362  	// [BetaToolSearchToolResultBlockContentUnion],
  8363  	// [BetaMCPToolResultBlockContentUnion], [string]
  8364  	Content   BetaRawContentBlockStartEventContentBlockUnionContent `json:"content"`
  8365  	ToolUseID string                                                `json:"tool_use_id"`
  8366  	// This field is from variant [BetaMCPToolUseBlock].
  8367  	ServerName string `json:"server_name"`
  8368  	// This field is from variant [BetaMCPToolResultBlock].
  8369  	IsError bool `json:"is_error"`
  8370  	// This field is from variant [BetaContainerUploadBlock].
  8371  	FileID string `json:"file_id"`
  8372  	// This field is from variant [BetaCompactionBlock].
  8373  	EncryptedContent string `json:"encrypted_content"`
  8374  	// This field is from variant [BetaFallbackBlock].
  8375  	From BetaFallbackInfo `json:"from"`
  8376  	// This field is from variant [BetaFallbackBlock].
  8377  	To BetaFallbackInfo `json:"to"`
  8378  	// This field is from variant [BetaFallbackBlock].
  8379  	Trigger BetaFallbackRefusalTrigger `json:"trigger"`
  8380  	JSON    struct {
  8381  		Citations        respjson.Field
  8382  		Text             respjson.Field
  8383  		Type             respjson.Field
  8384  		Signature        respjson.Field
  8385  		Thinking         respjson.Field
  8386  		Data             respjson.Field
  8387  		ID               respjson.Field
  8388  		Input            respjson.Field
  8389  		Name             respjson.Field
  8390  		Caller           respjson.Field
  8391  		ToolsetName      respjson.Field
  8392  		Content          respjson.Field
  8393  		ToolUseID        respjson.Field
  8394  		ServerName       respjson.Field
  8395  		IsError          respjson.Field
  8396  		FileID           respjson.Field
  8397  		EncryptedContent respjson.Field
  8398  		From             respjson.Field
  8399  		To               respjson.Field
  8400  		Trigger          respjson.Field
  8401  		raw              string
  8402  	} `json:"-"`
  8403  }
  8404  
  8405  // anyBetaRawContentBlockStartEventContentBlock is implemented by each variant of
  8406  // [BetaRawContentBlockStartEventContentBlockUnion] to add type safety for the
  8407  // return type of [BetaRawContentBlockStartEventContentBlockUnion.AsAny]
  8408  type anyBetaRawContentBlockStartEventContentBlock interface {
  8409  	implBetaRawContentBlockStartEventContentBlockUnion()
  8410  }
  8411  
  8412  func (BetaTextBlock) implBetaRawContentBlockStartEventContentBlockUnion()                        {}
  8413  func (BetaThinkingBlock) implBetaRawContentBlockStartEventContentBlockUnion()                    {}
  8414  func (BetaRedactedThinkingBlock) implBetaRawContentBlockStartEventContentBlockUnion()            {}
  8415  func (BetaToolUseBlock) implBetaRawContentBlockStartEventContentBlockUnion()                     {}
  8416  func (BetaServerToolUseBlock) implBetaRawContentBlockStartEventContentBlockUnion()               {}
  8417  func (BetaWebSearchToolResultBlock) implBetaRawContentBlockStartEventContentBlockUnion()         {}
  8418  func (BetaWebFetchToolResultBlock) implBetaRawContentBlockStartEventContentBlockUnion()          {}
  8419  func (BetaAdvisorToolResultBlock) implBetaRawContentBlockStartEventContentBlockUnion()           {}
  8420  func (BetaCodeExecutionToolResultBlock) implBetaRawContentBlockStartEventContentBlockUnion()     {}
  8421  func (BetaBashCodeExecutionToolResultBlock) implBetaRawContentBlockStartEventContentBlockUnion() {}
  8422  func (BetaTextEditorCodeExecutionToolResultBlock) implBetaRawContentBlockStartEventContentBlockUnion() {
  8423  }
  8424  func (BetaToolSearchToolResultBlock) implBetaRawContentBlockStartEventContentBlockUnion() {}
  8425  func (BetaMCPToolUseBlock) implBetaRawContentBlockStartEventContentBlockUnion()           {}
  8426  func (BetaMCPToolResultBlock) implBetaRawContentBlockStartEventContentBlockUnion()        {}
  8427  func (BetaContainerUploadBlock) implBetaRawContentBlockStartEventContentBlockUnion()      {}
  8428  func (BetaCompactionBlock) implBetaRawContentBlockStartEventContentBlockUnion()           {}
  8429  func (BetaFallbackBlock) implBetaRawContentBlockStartEventContentBlockUnion()             {}
  8430  
  8431  // Use the following switch statement to find the correct variant
  8432  //
  8433  //	switch variant := BetaRawContentBlockStartEventContentBlockUnion.AsAny().(type) {
  8434  //	case anthropic.BetaTextBlock:
  8435  //	case anthropic.BetaThinkingBlock:
  8436  //	case anthropic.BetaRedactedThinkingBlock:
  8437  //	case anthropic.BetaToolUseBlock:
  8438  //	case anthropic.BetaServerToolUseBlock:
  8439  //	case anthropic.BetaWebSearchToolResultBlock:
  8440  //	case anthropic.BetaWebFetchToolResultBlock:
  8441  //	case anthropic.BetaAdvisorToolResultBlock:
  8442  //	case anthropic.BetaCodeExecutionToolResultBlock:
  8443  //	case anthropic.BetaBashCodeExecutionToolResultBlock:
  8444  //	case anthropic.BetaTextEditorCodeExecutionToolResultBlock:
  8445  //	case anthropic.BetaToolSearchToolResultBlock:
  8446  //	case anthropic.BetaMCPToolUseBlock:
  8447  //	case anthropic.BetaMCPToolResultBlock:
  8448  //	case anthropic.BetaContainerUploadBlock:
  8449  //	case anthropic.BetaCompactionBlock:
  8450  //	case anthropic.BetaFallbackBlock:
  8451  //	default:
  8452  //	  fmt.Errorf("no variant present")
  8453  //	}
  8454  func (u BetaRawContentBlockStartEventContentBlockUnion) AsAny() anyBetaRawContentBlockStartEventContentBlock {
  8455  	switch u.Type {
  8456  	case "text":
  8457  		return u.AsText()
  8458  	case "thinking":
  8459  		return u.AsThinking()
  8460  	case "redacted_thinking":
  8461  		return u.AsRedactedThinking()
  8462  	case "tool_use":
  8463  		return u.AsToolUse()
  8464  	case "server_tool_use":
  8465  		return u.AsServerToolUse()
  8466  	case "web_search_tool_result":
  8467  		return u.AsWebSearchToolResult()
  8468  	case "web_fetch_tool_result":
  8469  		return u.AsWebFetchToolResult()
  8470  	case "advisor_tool_result":
  8471  		return u.AsAdvisorToolResult()
  8472  	case "code_execution_tool_result":
  8473  		return u.AsCodeExecutionToolResult()
  8474  	case "bash_code_execution_tool_result":
  8475  		return u.AsBashCodeExecutionToolResult()
  8476  	case "text_editor_code_execution_tool_result":
  8477  		return u.AsTextEditorCodeExecutionToolResult()
  8478  	case "tool_search_tool_result":
  8479  		return u.AsToolSearchToolResult()
  8480  	case "mcp_tool_use":
  8481  		return u.AsMCPToolUse()
  8482  	case "mcp_tool_result":
  8483  		return u.AsMCPToolResult()
  8484  	case "container_upload":
  8485  		return u.AsContainerUpload()
  8486  	case "compaction":
  8487  		return u.AsCompaction()
  8488  	case "fallback":
  8489  		return u.AsFallback()
  8490  	}
  8491  	return nil
  8492  }
  8493  
  8494  func (u BetaRawContentBlockStartEventContentBlockUnion) AsText() (v BetaTextBlock) {
  8495  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8496  	return
  8497  }
  8498  
  8499  func (u BetaRawContentBlockStartEventContentBlockUnion) AsThinking() (v BetaThinkingBlock) {
  8500  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8501  	return
  8502  }
  8503  
  8504  func (u BetaRawContentBlockStartEventContentBlockUnion) AsRedactedThinking() (v BetaRedactedThinkingBlock) {
  8505  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8506  	return
  8507  }
  8508  
  8509  func (u BetaRawContentBlockStartEventContentBlockUnion) AsToolUse() (v BetaToolUseBlock) {
  8510  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8511  	return
  8512  }
  8513  
  8514  func (u BetaRawContentBlockStartEventContentBlockUnion) AsServerToolUse() (v BetaServerToolUseBlock) {
  8515  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8516  	return
  8517  }
  8518  
  8519  func (u BetaRawContentBlockStartEventContentBlockUnion) AsWebSearchToolResult() (v BetaWebSearchToolResultBlock) {
  8520  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8521  	return
  8522  }
  8523  
  8524  func (u BetaRawContentBlockStartEventContentBlockUnion) AsWebFetchToolResult() (v BetaWebFetchToolResultBlock) {
  8525  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8526  	return
  8527  }
  8528  
  8529  func (u BetaRawContentBlockStartEventContentBlockUnion) AsAdvisorToolResult() (v BetaAdvisorToolResultBlock) {
  8530  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8531  	return
  8532  }
  8533  
  8534  func (u BetaRawContentBlockStartEventContentBlockUnion) AsCodeExecutionToolResult() (v BetaCodeExecutionToolResultBlock) {
  8535  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8536  	return
  8537  }
  8538  
  8539  func (u BetaRawContentBlockStartEventContentBlockUnion) AsBashCodeExecutionToolResult() (v BetaBashCodeExecutionToolResultBlock) {
  8540  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8541  	return
  8542  }
  8543  
  8544  func (u BetaRawContentBlockStartEventContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v BetaTextEditorCodeExecutionToolResultBlock) {
  8545  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8546  	return
  8547  }
  8548  
  8549  func (u BetaRawContentBlockStartEventContentBlockUnion) AsToolSearchToolResult() (v BetaToolSearchToolResultBlock) {
  8550  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8551  	return
  8552  }
  8553  
  8554  func (u BetaRawContentBlockStartEventContentBlockUnion) AsMCPToolUse() (v BetaMCPToolUseBlock) {
  8555  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8556  	return
  8557  }
  8558  
  8559  func (u BetaRawContentBlockStartEventContentBlockUnion) AsMCPToolResult() (v BetaMCPToolResultBlock) {
  8560  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8561  	return
  8562  }
  8563  
  8564  func (u BetaRawContentBlockStartEventContentBlockUnion) AsContainerUpload() (v BetaContainerUploadBlock) {
  8565  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8566  	return
  8567  }
  8568  
  8569  func (u BetaRawContentBlockStartEventContentBlockUnion) AsCompaction() (v BetaCompactionBlock) {
  8570  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8571  	return
  8572  }
  8573  
  8574  func (u BetaRawContentBlockStartEventContentBlockUnion) AsFallback() (v BetaFallbackBlock) {
  8575  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8576  	return
  8577  }
  8578  
  8579  // Returns the unmodified JSON received from the API
  8580  func (u BetaRawContentBlockStartEventContentBlockUnion) RawJSON() string { return u.JSON.raw }
  8581  
  8582  func (r *BetaRawContentBlockStartEventContentBlockUnion) UnmarshalJSON(data []byte) error {
  8583  	return apijson.UnmarshalRoot(data, r)
  8584  }
  8585  
  8586  // BetaRawContentBlockStartEventContentBlockUnionCaller is an implicit subunion of
  8587  // [BetaRawContentBlockStartEventContentBlockUnion].
  8588  // BetaRawContentBlockStartEventContentBlockUnionCaller provides convenient access
  8589  // to the sub-properties of the union.
  8590  //
  8591  // For type safety it is recommended to directly use a variant of the
  8592  // [BetaRawContentBlockStartEventContentBlockUnion].
  8593  type BetaRawContentBlockStartEventContentBlockUnionCaller struct {
  8594  	Type   string `json:"type"`
  8595  	ToolID string `json:"tool_id"`
  8596  	JSON   struct {
  8597  		Type   respjson.Field
  8598  		ToolID respjson.Field
  8599  		raw    string
  8600  	} `json:"-"`
  8601  }
  8602  
  8603  func (r *BetaRawContentBlockStartEventContentBlockUnionCaller) UnmarshalJSON(data []byte) error {
  8604  	return apijson.UnmarshalRoot(data, r)
  8605  }
  8606  
  8607  // BetaRawContentBlockStartEventContentBlockUnionContent is an implicit subunion of
  8608  // [BetaRawContentBlockStartEventContentBlockUnion].
  8609  // BetaRawContentBlockStartEventContentBlockUnionContent provides convenient access
  8610  // to the sub-properties of the union.
  8611  //
  8612  // For type safety it is recommended to directly use a variant of the
  8613  // [BetaRawContentBlockStartEventContentBlockUnion].
  8614  //
  8615  // If the underlying value is not a json object, one of the following properties
  8616  // will be valid: OfBetaWebSearchResultBlockArray OfString
  8617  // OfBetaMCPToolResultBlockContent]
  8618  type BetaRawContentBlockStartEventContentBlockUnionContent struct {
  8619  	// This field will be present if the value is a [[]BetaWebSearchResultBlock]
  8620  	// instead of an object.
  8621  	OfBetaWebSearchResultBlockArray []BetaWebSearchResultBlock `json:",inline"`
  8622  	// This field will be present if the value is a [string] instead of an object.
  8623  	OfString string `json:",inline"`
  8624  	// This field will be present if the value is a [[]BetaTextBlock] instead of an
  8625  	// object.
  8626  	OfBetaMCPToolResultBlockContent []BetaTextBlock `json:",inline"`
  8627  	ErrorCode                       string          `json:"error_code"`
  8628  	Type                            string          `json:"type"`
  8629  	// This field is a union of [BetaDocumentBlock], [[]BetaCodeExecutionOutputBlock],
  8630  	// [[]BetaCodeExecutionOutputBlock], [[]BetaBashCodeExecutionOutputBlock], [string]
  8631  	Content BetaRawContentBlockStartEventContentBlockUnionContentContent `json:"content"`
  8632  	// This field is from variant [BetaWebFetchToolResultBlockContentUnion].
  8633  	RetrievedAt string `json:"retrieved_at"`
  8634  	// This field is from variant [BetaWebFetchToolResultBlockContentUnion].
  8635  	URL        string `json:"url"`
  8636  	StopReason string `json:"stop_reason"`
  8637  	// This field is from variant [BetaAdvisorToolResultBlockContentUnion].
  8638  	Text string `json:"text"`
  8639  	// This field is from variant [BetaAdvisorToolResultBlockContentUnion].
  8640  	EncryptedContent string `json:"encrypted_content"`
  8641  	ReturnCode       int64  `json:"return_code"`
  8642  	Stderr           string `json:"stderr"`
  8643  	Stdout           string `json:"stdout"`
  8644  	// This field is from variant [BetaCodeExecutionToolResultBlockContentUnion].
  8645  	EncryptedStdout string `json:"encrypted_stdout"`
  8646  	ErrorMessage    string `json:"error_message"`
  8647  	// This field is from variant
  8648  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8649  	FileType BetaTextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
  8650  	// This field is from variant
  8651  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8652  	NumLines int64 `json:"num_lines"`
  8653  	// This field is from variant
  8654  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8655  	StartLine int64 `json:"start_line"`
  8656  	// This field is from variant
  8657  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8658  	TotalLines int64 `json:"total_lines"`
  8659  	// This field is from variant
  8660  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8661  	IsFileUpdate bool `json:"is_file_update"`
  8662  	// This field is from variant
  8663  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8664  	Lines []string `json:"lines"`
  8665  	// This field is from variant
  8666  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8667  	NewLines int64 `json:"new_lines"`
  8668  	// This field is from variant
  8669  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8670  	NewStart int64 `json:"new_start"`
  8671  	// This field is from variant
  8672  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8673  	OldLines int64 `json:"old_lines"`
  8674  	// This field is from variant
  8675  	// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
  8676  	OldStart int64 `json:"old_start"`
  8677  	// This field is from variant [BetaToolSearchToolResultBlockContentUnion].
  8678  	ToolReferences []BetaToolReferenceBlock `json:"tool_references"`
  8679  	JSON           struct {
  8680  		OfBetaWebSearchResultBlockArray respjson.Field
  8681  		OfString                        respjson.Field
  8682  		OfBetaMCPToolResultBlockContent respjson.Field
  8683  		ErrorCode                       respjson.Field
  8684  		Type                            respjson.Field
  8685  		Content                         respjson.Field
  8686  		RetrievedAt                     respjson.Field
  8687  		URL                             respjson.Field
  8688  		StopReason                      respjson.Field
  8689  		Text                            respjson.Field
  8690  		EncryptedContent                respjson.Field
  8691  		ReturnCode                      respjson.Field
  8692  		Stderr                          respjson.Field
  8693  		Stdout                          respjson.Field
  8694  		EncryptedStdout                 respjson.Field
  8695  		ErrorMessage                    respjson.Field
  8696  		FileType                        respjson.Field
  8697  		NumLines                        respjson.Field
  8698  		StartLine                       respjson.Field
  8699  		TotalLines                      respjson.Field
  8700  		IsFileUpdate                    respjson.Field
  8701  		Lines                           respjson.Field
  8702  		NewLines                        respjson.Field
  8703  		NewStart                        respjson.Field
  8704  		OldLines                        respjson.Field
  8705  		OldStart                        respjson.Field
  8706  		ToolReferences                  respjson.Field
  8707  		raw                             string
  8708  	} `json:"-"`
  8709  }
  8710  
  8711  func (r *BetaRawContentBlockStartEventContentBlockUnionContent) UnmarshalJSON(data []byte) error {
  8712  	return apijson.UnmarshalRoot(data, r)
  8713  }
  8714  
  8715  // BetaRawContentBlockStartEventContentBlockUnionContentContent is an implicit
  8716  // subunion of [BetaRawContentBlockStartEventContentBlockUnion].
  8717  // BetaRawContentBlockStartEventContentBlockUnionContentContent provides convenient
  8718  // access to the sub-properties of the union.
  8719  //
  8720  // For type safety it is recommended to directly use a variant of the
  8721  // [BetaRawContentBlockStartEventContentBlockUnion].
  8722  //
  8723  // If the underlying value is not a json object, one of the following properties
  8724  // will be valid: OfContent OfString]
  8725  type BetaRawContentBlockStartEventContentBlockUnionContentContent struct {
  8726  	// This field will be present if the value is a [[]BetaCodeExecutionOutputBlock]
  8727  	// instead of an object.
  8728  	OfContent []BetaCodeExecutionOutputBlock `json:",inline"`
  8729  	// This field will be present if the value is a [string] instead of an object.
  8730  	OfString string `json:",inline"`
  8731  	// This field is from variant [BetaDocumentBlock].
  8732  	Citations BetaCitationConfig `json:"citations"`
  8733  	// This field is from variant [BetaDocumentBlock].
  8734  	Source BetaDocumentBlockSourceUnion `json:"source"`
  8735  	// This field is from variant [BetaDocumentBlock].
  8736  	Title string `json:"title"`
  8737  	// This field is from variant [BetaDocumentBlock].
  8738  	Type constant.Document `json:"type"`
  8739  	JSON struct {
  8740  		OfContent respjson.Field
  8741  		OfString  respjson.Field
  8742  		Citations respjson.Field
  8743  		Source    respjson.Field
  8744  		Title     respjson.Field
  8745  		Type      respjson.Field
  8746  		raw       string
  8747  	} `json:"-"`
  8748  }
  8749  
  8750  func (r *BetaRawContentBlockStartEventContentBlockUnionContentContent) UnmarshalJSON(data []byte) error {
  8751  	return apijson.UnmarshalRoot(data, r)
  8752  }
  8753  
  8754  type BetaRawContentBlockStopEvent struct {
  8755  	Index int64                     `json:"index" api:"required"`
  8756  	Type  constant.ContentBlockStop `json:"type" default:"content_block_stop"`
  8757  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8758  	JSON struct {
  8759  		Index       respjson.Field
  8760  		Type        respjson.Field
  8761  		ExtraFields map[string]respjson.Field
  8762  		raw         string
  8763  	} `json:"-"`
  8764  }
  8765  
  8766  // Returns the unmodified JSON received from the API
  8767  func (r BetaRawContentBlockStopEvent) RawJSON() string { return r.JSON.raw }
  8768  func (r *BetaRawContentBlockStopEvent) UnmarshalJSON(data []byte) error {
  8769  	return apijson.UnmarshalRoot(data, r)
  8770  }
  8771  
  8772  type BetaRawMessageDeltaEvent struct {
  8773  	// Information about context management strategies applied during the request
  8774  	ContextManagement BetaContextManagementResponse `json:"context_management" api:"required"`
  8775  	Delta             BetaRawMessageDeltaEventDelta `json:"delta" api:"required"`
  8776  	Type              constant.MessageDelta         `json:"type" default:"message_delta"`
  8777  	// Billing and rate-limit usage.
  8778  	//
  8779  	// Anthropic's API bills and rate-limits by token counts, as tokens represent the
  8780  	// underlying cost to our systems.
  8781  	//
  8782  	// Under the hood, the API transforms requests into a format suitable for the
  8783  	// model. The model's output then goes through a parsing stage before becoming an
  8784  	// API response. As a result, the token counts in `usage` will not match one-to-one
  8785  	// with the exact visible content of an API request or response.
  8786  	//
  8787  	// For example, `output_tokens` will be non-zero, even for an empty string response
  8788  	// from Claude.
  8789  	//
  8790  	// Total input tokens in a request is the summation of `input_tokens`,
  8791  	// `cache_creation_input_tokens`, and `cache_read_input_tokens`.
  8792  	Usage BetaMessageDeltaUsage `json:"usage" api:"required"`
  8793  	// Changes the API made to the request's input before showing it to the model: one
  8794  	// entry per change, in request order. Today the only entry type is
  8795  	// `thinking_dropped` — a `thinking`, `redacted_thinking` or `connector_text` block
  8796  	// from the request's `messages` that was removed from the prompt instead of being
  8797  	// shown to the model because it failed a binding check. More entry types may be
  8798  	// added over time; ignore types you do not recognize.
  8799  	//
  8800  	// Requires `anthropic-beta: thinking-binding-controls-2026-08-01`. Present on
  8801  	// every such response from a model that supports extended thinking, as `[]` when
  8802  	// nothing was changed; without the beta, blocks are removed all the same but
  8803  	// nothing is reported. Removed blocks contribute nothing to `usage.input_tokens`.
  8804  	// When streaming, the array is final in `message_start`; the final `message_delta`
  8805  	// event carries it only when a server-side model fallback happened mid-stream, in
  8806  	// which case it holds the serving model's entries and replaces the one in
  8807  	// `message_start`.
  8808  	InputTransformations []BetaThinkingDroppedInputTransformation `json:"input_transformations" api:"nullable"`
  8809  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8810  	JSON struct {
  8811  		ContextManagement    respjson.Field
  8812  		Delta                respjson.Field
  8813  		Type                 respjson.Field
  8814  		Usage                respjson.Field
  8815  		InputTransformations respjson.Field
  8816  		ExtraFields          map[string]respjson.Field
  8817  		raw                  string
  8818  	} `json:"-"`
  8819  }
  8820  
  8821  // Returns the unmodified JSON received from the API
  8822  func (r BetaRawMessageDeltaEvent) RawJSON() string { return r.JSON.raw }
  8823  func (r *BetaRawMessageDeltaEvent) UnmarshalJSON(data []byte) error {
  8824  	return apijson.UnmarshalRoot(data, r)
  8825  }
  8826  
  8827  type BetaRawMessageDeltaEventDelta struct {
  8828  	// Information about the container used in the request (for the code execution
  8829  	// tool)
  8830  	Container BetaContainer `json:"container" api:"required"`
  8831  	// Structured information about a refusal.
  8832  	StopDetails BetaRefusalStopDetails `json:"stop_details" api:"required"`
  8833  	// Any of "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn",
  8834  	// "compaction", "refusal", "model_context_window_exceeded".
  8835  	StopReason   BetaStopReason `json:"stop_reason" api:"required"`
  8836  	StopSequence string         `json:"stop_sequence" api:"required"`
  8837  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8838  	JSON struct {
  8839  		Container    respjson.Field
  8840  		StopDetails  respjson.Field
  8841  		StopReason   respjson.Field
  8842  		StopSequence respjson.Field
  8843  		ExtraFields  map[string]respjson.Field
  8844  		raw          string
  8845  	} `json:"-"`
  8846  }
  8847  
  8848  // Returns the unmodified JSON received from the API
  8849  func (r BetaRawMessageDeltaEventDelta) RawJSON() string { return r.JSON.raw }
  8850  func (r *BetaRawMessageDeltaEventDelta) UnmarshalJSON(data []byte) error {
  8851  	return apijson.UnmarshalRoot(data, r)
  8852  }
  8853  
  8854  type BetaRawMessageStartEvent struct {
  8855  	Message BetaMessage           `json:"message" api:"required"`
  8856  	Type    constant.MessageStart `json:"type" default:"message_start"`
  8857  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8858  	JSON struct {
  8859  		Message     respjson.Field
  8860  		Type        respjson.Field
  8861  		ExtraFields map[string]respjson.Field
  8862  		raw         string
  8863  	} `json:"-"`
  8864  }
  8865  
  8866  // Returns the unmodified JSON received from the API
  8867  func (r BetaRawMessageStartEvent) RawJSON() string { return r.JSON.raw }
  8868  func (r *BetaRawMessageStartEvent) UnmarshalJSON(data []byte) error {
  8869  	return apijson.UnmarshalRoot(data, r)
  8870  }
  8871  
  8872  type BetaRawMessageStopEvent struct {
  8873  	Type constant.MessageStop `json:"type" default:"message_stop"`
  8874  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  8875  	JSON struct {
  8876  		Type        respjson.Field
  8877  		ExtraFields map[string]respjson.Field
  8878  		raw         string
  8879  	} `json:"-"`
  8880  }
  8881  
  8882  // Returns the unmodified JSON received from the API
  8883  func (r BetaRawMessageStopEvent) RawJSON() string { return r.JSON.raw }
  8884  func (r *BetaRawMessageStopEvent) UnmarshalJSON(data []byte) error {
  8885  	return apijson.UnmarshalRoot(data, r)
  8886  }
  8887  
  8888  // BetaRawMessageStreamEventUnion contains all possible properties and values from
  8889  // [BetaRawMessageStartEvent], [BetaRawMessageDeltaEvent],
  8890  // [BetaRawMessageStopEvent], [BetaRawContentBlockStartEvent],
  8891  // [BetaRawContentBlockDeltaEvent], [BetaRawContentBlockStopEvent].
  8892  //
  8893  // Use the [BetaRawMessageStreamEventUnion.AsAny] method to switch on the variant.
  8894  //
  8895  // Use the methods beginning with 'As' to cast the union to one of its variants.
  8896  type BetaRawMessageStreamEventUnion struct {
  8897  	// This field is from variant [BetaRawMessageStartEvent].
  8898  	Message BetaMessage `json:"message"`
  8899  	// Any of "message_start", "message_delta", "message_stop", "content_block_start",
  8900  	// "content_block_delta", "content_block_stop".
  8901  	Type string `json:"type"`
  8902  	// This field is from variant [BetaRawMessageDeltaEvent].
  8903  	ContextManagement BetaContextManagementResponse `json:"context_management"`
  8904  	// This field is a union of [BetaRawMessageDeltaEventDelta],
  8905  	// [BetaRawContentBlockDeltaUnion]
  8906  	Delta BetaRawMessageStreamEventUnionDelta `json:"delta"`
  8907  	// This field is from variant [BetaRawMessageDeltaEvent].
  8908  	Usage BetaMessageDeltaUsage `json:"usage"`
  8909  	// This field is from variant [BetaRawMessageDeltaEvent].
  8910  	InputTransformations []BetaThinkingDroppedInputTransformation `json:"input_transformations"`
  8911  	// This field is from variant [BetaRawContentBlockStartEvent].
  8912  	ContentBlock BetaRawContentBlockStartEventContentBlockUnion `json:"content_block"`
  8913  	Index        int64                                          `json:"index"`
  8914  	JSON         struct {
  8915  		Message              respjson.Field
  8916  		Type                 respjson.Field
  8917  		ContextManagement    respjson.Field
  8918  		Delta                respjson.Field
  8919  		Usage                respjson.Field
  8920  		InputTransformations respjson.Field
  8921  		ContentBlock         respjson.Field
  8922  		Index                respjson.Field
  8923  		raw                  string
  8924  	} `json:"-"`
  8925  }
  8926  
  8927  // anyBetaRawMessageStreamEvent is implemented by each variant of
  8928  // [BetaRawMessageStreamEventUnion] to add type safety for the return type of
  8929  // [BetaRawMessageStreamEventUnion.AsAny]
  8930  type anyBetaRawMessageStreamEvent interface {
  8931  	implBetaRawMessageStreamEventUnion()
  8932  }
  8933  
  8934  func (BetaRawMessageStartEvent) implBetaRawMessageStreamEventUnion()      {}
  8935  func (BetaRawMessageDeltaEvent) implBetaRawMessageStreamEventUnion()      {}
  8936  func (BetaRawMessageStopEvent) implBetaRawMessageStreamEventUnion()       {}
  8937  func (BetaRawContentBlockStartEvent) implBetaRawMessageStreamEventUnion() {}
  8938  func (BetaRawContentBlockDeltaEvent) implBetaRawMessageStreamEventUnion() {}
  8939  func (BetaRawContentBlockStopEvent) implBetaRawMessageStreamEventUnion()  {}
  8940  
  8941  // Use the following switch statement to find the correct variant
  8942  //
  8943  //	switch variant := BetaRawMessageStreamEventUnion.AsAny().(type) {
  8944  //	case anthropic.BetaRawMessageStartEvent:
  8945  //	case anthropic.BetaRawMessageDeltaEvent:
  8946  //	case anthropic.BetaRawMessageStopEvent:
  8947  //	case anthropic.BetaRawContentBlockStartEvent:
  8948  //	case anthropic.BetaRawContentBlockDeltaEvent:
  8949  //	case anthropic.BetaRawContentBlockStopEvent:
  8950  //	default:
  8951  //	  fmt.Errorf("no variant present")
  8952  //	}
  8953  func (u BetaRawMessageStreamEventUnion) AsAny() anyBetaRawMessageStreamEvent {
  8954  	switch u.Type {
  8955  	case "message_start":
  8956  		return u.AsMessageStart()
  8957  	case "message_delta":
  8958  		return u.AsMessageDelta()
  8959  	case "message_stop":
  8960  		return u.AsMessageStop()
  8961  	case "content_block_start":
  8962  		return u.AsContentBlockStart()
  8963  	case "content_block_delta":
  8964  		return u.AsContentBlockDelta()
  8965  	case "content_block_stop":
  8966  		return u.AsContentBlockStop()
  8967  	}
  8968  	return nil
  8969  }
  8970  
  8971  func (u BetaRawMessageStreamEventUnion) AsMessageStart() (v BetaRawMessageStartEvent) {
  8972  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8973  	return
  8974  }
  8975  
  8976  func (u BetaRawMessageStreamEventUnion) AsMessageDelta() (v BetaRawMessageDeltaEvent) {
  8977  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8978  	return
  8979  }
  8980  
  8981  func (u BetaRawMessageStreamEventUnion) AsMessageStop() (v BetaRawMessageStopEvent) {
  8982  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8983  	return
  8984  }
  8985  
  8986  func (u BetaRawMessageStreamEventUnion) AsContentBlockStart() (v BetaRawContentBlockStartEvent) {
  8987  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8988  	return
  8989  }
  8990  
  8991  func (u BetaRawMessageStreamEventUnion) AsContentBlockDelta() (v BetaRawContentBlockDeltaEvent) {
  8992  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8993  	return
  8994  }
  8995  
  8996  func (u BetaRawMessageStreamEventUnion) AsContentBlockStop() (v BetaRawContentBlockStopEvent) {
  8997  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  8998  	return
  8999  }
  9000  
  9001  // Returns the unmodified JSON received from the API
  9002  func (u BetaRawMessageStreamEventUnion) RawJSON() string { return u.JSON.raw }
  9003  
  9004  func (r *BetaRawMessageStreamEventUnion) UnmarshalJSON(data []byte) error {
  9005  	return apijson.UnmarshalRoot(data, r)
  9006  }
  9007  
  9008  // BetaRawMessageStreamEventUnionDelta is an implicit subunion of
  9009  // [BetaRawMessageStreamEventUnion]. BetaRawMessageStreamEventUnionDelta provides
  9010  // convenient access to the sub-properties of the union.
  9011  //
  9012  // For type safety it is recommended to directly use a variant of the
  9013  // [BetaRawMessageStreamEventUnion].
  9014  type BetaRawMessageStreamEventUnionDelta struct {
  9015  	// This field is from variant [BetaRawMessageDeltaEventDelta].
  9016  	Container BetaContainer `json:"container"`
  9017  	// This field is from variant [BetaRawMessageDeltaEventDelta].
  9018  	StopDetails BetaRefusalStopDetails `json:"stop_details"`
  9019  	// This field is from variant [BetaRawMessageDeltaEventDelta].
  9020  	StopReason BetaStopReason `json:"stop_reason"`
  9021  	// This field is from variant [BetaRawMessageDeltaEventDelta].
  9022  	StopSequence string `json:"stop_sequence"`
  9023  	// This field is from variant [BetaRawContentBlockDeltaUnion].
  9024  	Text string `json:"text"`
  9025  	Type string `json:"type"`
  9026  	// This field is from variant [BetaRawContentBlockDeltaUnion].
  9027  	PartialJSON string `json:"partial_json"`
  9028  	// This field is from variant [BetaRawContentBlockDeltaUnion].
  9029  	Citation BetaCitationsDeltaCitationUnion `json:"citation"`
  9030  	// This field is from variant [BetaRawContentBlockDeltaUnion].
  9031  	EstimatedTokens int64 `json:"estimated_tokens"`
  9032  	// This field is from variant [BetaRawContentBlockDeltaUnion].
  9033  	Thinking string `json:"thinking"`
  9034  	// This field is from variant [BetaRawContentBlockDeltaUnion].
  9035  	Signature string `json:"signature"`
  9036  	// This field is from variant [BetaRawContentBlockDeltaUnion].
  9037  	Content string `json:"content"`
  9038  	// This field is from variant [BetaRawContentBlockDeltaUnion].
  9039  	EncryptedContent string `json:"encrypted_content"`
  9040  	JSON             struct {
  9041  		Container        respjson.Field
  9042  		StopDetails      respjson.Field
  9043  		StopReason       respjson.Field
  9044  		StopSequence     respjson.Field
  9045  		Text             respjson.Field
  9046  		Type             respjson.Field
  9047  		PartialJSON      respjson.Field
  9048  		Citation         respjson.Field
  9049  		EstimatedTokens  respjson.Field
  9050  		Thinking         respjson.Field
  9051  		Signature        respjson.Field
  9052  		Content          respjson.Field
  9053  		EncryptedContent respjson.Field
  9054  		raw              string
  9055  	} `json:"-"`
  9056  }
  9057  
  9058  func (r *BetaRawMessageStreamEventUnionDelta) UnmarshalJSON(data []byte) error {
  9059  	return apijson.UnmarshalRoot(data, r)
  9060  }
  9061  
  9062  type BetaRedactedThinkingBlock struct {
  9063  	// The contents of this redacted thinking block, returned when portions of the
  9064  	// model's thinking were safety-redacted. This field is opaque and encrypted, with
  9065  	// no readable content.
  9066  	//
  9067  	// Pass `redacted_thinking` blocks back to the API unchanged when continuing a
  9068  	// multi-turn conversation.
  9069  	//
  9070  	// See
  9071  	// [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#redacted-thinking-blocks)
  9072  	// for details.
  9073  	Data string                    `json:"data" api:"required"`
  9074  	Type constant.RedactedThinking `json:"type" default:"redacted_thinking"`
  9075  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  9076  	JSON struct {
  9077  		Data        respjson.Field
  9078  		Type        respjson.Field
  9079  		ExtraFields map[string]respjson.Field
  9080  		raw         string
  9081  	} `json:"-"`
  9082  }
  9083  
  9084  // Returns the unmodified JSON received from the API
  9085  func (r BetaRedactedThinkingBlock) RawJSON() string { return r.JSON.raw }
  9086  func (r *BetaRedactedThinkingBlock) UnmarshalJSON(data []byte) error {
  9087  	return apijson.UnmarshalRoot(data, r)
  9088  }
  9089  
  9090  // The properties Data, Type are required.
  9091  type BetaRedactedThinkingBlockParam struct {
  9092  	// The `data` value of this redacted thinking block, exactly as returned by the API
  9093  	// in a previous response. Opaque and encrypted; pass it back unchanged.
  9094  	Data string `json:"data" api:"required"`
  9095  	// This field can be elided, and will marshal its zero value as
  9096  	// "redacted_thinking".
  9097  	Type constant.RedactedThinking `json:"type" default:"redacted_thinking"`
  9098  	paramObj
  9099  }
  9100  
  9101  func (r BetaRedactedThinkingBlockParam) MarshalJSON() (data []byte, err error) {
  9102  	type shadow BetaRedactedThinkingBlockParam
  9103  	return param.MarshalObject(r, (*shadow)(&r))
  9104  }
  9105  func (r *BetaRedactedThinkingBlockParam) UnmarshalJSON(data []byte) error {
  9106  	return apijson.UnmarshalRoot(data, r)
  9107  }
  9108  
  9109  // Structured information about a refusal.
  9110  type BetaRefusalStopDetails struct {
  9111  	// The policy category that triggered a refusal.
  9112  	//
  9113  	// Any of "cyber", "bio", "frontier_llm", "reasoning_extraction", "general_harms".
  9114  	Category BetaRefusalStopDetailsCategory `json:"category" api:"required"`
  9115  	// Human-readable explanation of the refusal.
  9116  	//
  9117  	// This text is not guaranteed to be stable. `null` when no explanation is
  9118  	// available for the category.
  9119  	Explanation string `json:"explanation" api:"required"`
  9120  	// Opaque code that refunds the cache-miss cost when retrying this refused request
  9121  	// on the fallback model. Pass it as `fallback_credit_token` on the retry request.
  9122  	// Expires 5 minutes after the refusal.
  9123  	//
  9124  	// The retry is sent either with the same request body (`system`, `messages`,
  9125  	// `tools`, and other render-shaping fields), or with the same body plus one
  9126  	// appended `assistant` message whose content is the partial text (with any
  9127  	// trailing whitespace stripped from the final text block) and paired server-tool
  9128  	// blocks from this refusal — which also authorizes that appended turn as an
  9129  	// assistant-prefill continuation on models that otherwise disallow prefill. A
  9130  	// token minted mid-server-tool-loop whose partial content was continuable may only
  9131  	// be redeemed the second way — if a same-body retry is rejected with a 400 saying
  9132  	// the token must be redeemed by continuing the partial response, retry the second
  9133  	// way instead. Either way: same workspace, same platform; a mismatch is a 400.
  9134  	// Resending a token for an already-warm prefix is permitted but yields no
  9135  	// additional credit.
  9136  	//
  9137  	// `null` when the refused model isn't eligible for a fallback credit.
  9138  	FallbackCreditToken string `json:"fallback_credit_token" api:"required"`
  9139  	// Whether the accompanying `fallback_credit_token` may be redeemed with the
  9140  	// appended-assistant retry form. Only set when `fallback_credit_token` is present.
  9141  	//
  9142  	// `true`: retry by resending the same request body plus one appended `assistant`
  9143  	// message whose content is this response's `content` with any trailing whitespace
  9144  	// stripped from the final text block and unpaired `tool_use` blocks omitted (the
  9145  	// same appended-turn shape described on `fallback_credit_token`), with the token
  9146  	// attached. `false`: retry by resending the original request body unchanged, with
  9147  	// the token attached — the appended-assistant form is not available for this
  9148  	// refusal (no continuable partial content, or the request uses `output_format` or
  9149  	// a `tool_choice` that forces tool use). One exception: when the request used
  9150  	// `output_format` or a forced `tool_choice` and the refusal arrived after server
  9151  	// tools (including MCP connector tools) had already executed, the token may not be
  9152  	// redeemable by either retry form; if the exact-body retry is then rejected with a
  9153  	// 400 saying the token must be redeemed by continuing the partial response,
  9154  	// discard the token and retry without it.
  9155  	//
  9156  	// Advisory: if an appended-assistant retry is rejected with a 400 despite `true`,
  9157  	// fall back to resending the original request body with the token.
  9158  	FallbackHasPrefillClaim bool `json:"fallback_has_prefill_claim" api:"required"`
  9159  	// The server's suggested retry target for this refusal. Populated when a fallback
  9160  	// attempt could not be made (the fallback model's rate limit was exhausted, or it
  9161  	// was overloaded); names the fallback model the caller can retry directly. Null
  9162  	// otherwise.
  9163  	RecommendedModel string           `json:"recommended_model" api:"required"`
  9164  	Type             constant.Refusal `json:"type" default:"refusal"`
  9165  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  9166  	JSON struct {
  9167  		Category                respjson.Field
  9168  		Explanation             respjson.Field
  9169  		FallbackCreditToken     respjson.Field
  9170  		FallbackHasPrefillClaim respjson.Field
  9171  		RecommendedModel        respjson.Field
  9172  		Type                    respjson.Field
  9173  		ExtraFields             map[string]respjson.Field
  9174  		raw                     string
  9175  	} `json:"-"`
  9176  }
  9177  
  9178  // Returns the unmodified JSON received from the API
  9179  func (r BetaRefusalStopDetails) RawJSON() string { return r.JSON.raw }
  9180  func (r *BetaRefusalStopDetails) UnmarshalJSON(data []byte) error {
  9181  	return apijson.UnmarshalRoot(data, r)
  9182  }
  9183  
  9184  // The policy category that triggered a refusal.
  9185  type BetaRefusalStopDetailsCategory string
  9186  
  9187  const (
  9188  	BetaRefusalStopDetailsCategoryCyber               BetaRefusalStopDetailsCategory = "cyber"
  9189  	BetaRefusalStopDetailsCategoryBio                 BetaRefusalStopDetailsCategory = "bio"
  9190  	BetaRefusalStopDetailsCategoryFrontierLLM         BetaRefusalStopDetailsCategory = "frontier_llm"
  9191  	BetaRefusalStopDetailsCategoryReasoningExtraction BetaRefusalStopDetailsCategory = "reasoning_extraction"
  9192  	BetaRefusalStopDetailsCategoryGeneralHarms        BetaRefusalStopDetailsCategory = "general_harms"
  9193  )
  9194  
  9195  // The properties Source, Type are required.
  9196  type BetaRequestDocumentBlockParam struct {
  9197  	Source  BetaRequestDocumentBlockSourceUnionParam `json:"source,omitzero" api:"required"`
  9198  	Context param.Opt[string]                        `json:"context,omitzero"`
  9199  	Title   param.Opt[string]                        `json:"title,omitzero"`
  9200  	// Create a cache control breakpoint at this content block.
  9201  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  9202  	Citations    BetaCitationsConfigParam       `json:"citations,omitzero"`
  9203  	// This field can be elided, and will marshal its zero value as "document".
  9204  	Type constant.Document `json:"type" default:"document"`
  9205  	paramObj
  9206  }
  9207  
  9208  func (r BetaRequestDocumentBlockParam) MarshalJSON() (data []byte, err error) {
  9209  	type shadow BetaRequestDocumentBlockParam
  9210  	return param.MarshalObject(r, (*shadow)(&r))
  9211  }
  9212  func (r *BetaRequestDocumentBlockParam) UnmarshalJSON(data []byte) error {
  9213  	return apijson.UnmarshalRoot(data, r)
  9214  }
  9215  
  9216  // Only one field can be non-zero.
  9217  //
  9218  // Use [param.IsOmitted] to confirm if a field is set.
  9219  type BetaRequestDocumentBlockSourceUnionParam struct {
  9220  	OfBase64  *BetaBase64PDFSourceParam    `json:",omitzero,inline"`
  9221  	OfText    *BetaPlainTextSourceParam    `json:",omitzero,inline"`
  9222  	OfContent *BetaContentBlockSourceParam `json:",omitzero,inline"`
  9223  	OfURL     *BetaURLPDFSourceParam       `json:",omitzero,inline"`
  9224  	OfFile    *BetaFileDocumentSourceParam `json:",omitzero,inline"`
  9225  	paramUnion
  9226  }
  9227  
  9228  func (u BetaRequestDocumentBlockSourceUnionParam) MarshalJSON() ([]byte, error) {
  9229  	return param.MarshalUnion(u, u.OfBase64,
  9230  		u.OfText,
  9231  		u.OfContent,
  9232  		u.OfURL,
  9233  		u.OfFile)
  9234  }
  9235  func (u *BetaRequestDocumentBlockSourceUnionParam) UnmarshalJSON(data []byte) error {
  9236  	return apijson.UnmarshalRoot(data, u)
  9237  }
  9238  
  9239  func (u *BetaRequestDocumentBlockSourceUnionParam) asAny() any {
  9240  	if !param.IsOmitted(u.OfBase64) {
  9241  		return u.OfBase64
  9242  	} else if !param.IsOmitted(u.OfText) {
  9243  		return u.OfText
  9244  	} else if !param.IsOmitted(u.OfContent) {
  9245  		return u.OfContent
  9246  	} else if !param.IsOmitted(u.OfURL) {
  9247  		return u.OfURL
  9248  	} else if !param.IsOmitted(u.OfFile) {
  9249  		return u.OfFile
  9250  	}
  9251  	return nil
  9252  }
  9253  
  9254  // Returns a pointer to the underlying variant's property, if present.
  9255  func (u BetaRequestDocumentBlockSourceUnionParam) GetContent() *BetaContentBlockSourceContentUnionParam {
  9256  	if vt := u.OfContent; vt != nil {
  9257  		return &vt.Content
  9258  	}
  9259  	return nil
  9260  }
  9261  
  9262  // Returns a pointer to the underlying variant's property, if present.
  9263  func (u BetaRequestDocumentBlockSourceUnionParam) GetURL() *string {
  9264  	if vt := u.OfURL; vt != nil {
  9265  		return &vt.URL
  9266  	}
  9267  	return nil
  9268  }
  9269  
  9270  // Returns a pointer to the underlying variant's property, if present.
  9271  func (u BetaRequestDocumentBlockSourceUnionParam) GetFileID() *string {
  9272  	if vt := u.OfFile; vt != nil {
  9273  		return &vt.FileID
  9274  	}
  9275  	return nil
  9276  }
  9277  
  9278  // Returns a pointer to the underlying variant's property, if present.
  9279  func (u BetaRequestDocumentBlockSourceUnionParam) GetData() *string {
  9280  	if vt := u.OfBase64; vt != nil {
  9281  		return (*string)(&vt.Data)
  9282  	} else if vt := u.OfText; vt != nil {
  9283  		return (*string)(&vt.Data)
  9284  	}
  9285  	return nil
  9286  }
  9287  
  9288  // Returns a pointer to the underlying variant's property, if present.
  9289  func (u BetaRequestDocumentBlockSourceUnionParam) GetMediaType() *string {
  9290  	if vt := u.OfBase64; vt != nil {
  9291  		return (*string)(&vt.MediaType)
  9292  	} else if vt := u.OfText; vt != nil {
  9293  		return (*string)(&vt.MediaType)
  9294  	}
  9295  	return nil
  9296  }
  9297  
  9298  // Returns a pointer to the underlying variant's property, if present.
  9299  func (u BetaRequestDocumentBlockSourceUnionParam) GetType() *string {
  9300  	if vt := u.OfBase64; vt != nil {
  9301  		return (*string)(&vt.Type)
  9302  	} else if vt := u.OfText; vt != nil {
  9303  		return (*string)(&vt.Type)
  9304  	} else if vt := u.OfContent; vt != nil {
  9305  		return (*string)(&vt.Type)
  9306  	} else if vt := u.OfURL; vt != nil {
  9307  		return (*string)(&vt.Type)
  9308  	} else if vt := u.OfFile; vt != nil {
  9309  		return (*string)(&vt.Type)
  9310  	}
  9311  	return nil
  9312  }
  9313  
  9314  func init() {
  9315  	apijson.RegisterUnion[BetaRequestDocumentBlockSourceUnionParam](
  9316  		"type",
  9317  		apijson.Discriminator[BetaBase64PDFSourceParam]("base64"),
  9318  		apijson.Discriminator[BetaPlainTextSourceParam]("text"),
  9319  		apijson.Discriminator[BetaContentBlockSourceParam]("content"),
  9320  		apijson.Discriminator[BetaURLPDFSourceParam]("url"),
  9321  		apijson.Discriminator[BetaFileDocumentSourceParam]("file"),
  9322  	)
  9323  }
  9324  
  9325  type BetaRequestMCPServerToolConfigurationParam struct {
  9326  	Enabled      param.Opt[bool] `json:"enabled,omitzero"`
  9327  	AllowedTools []string        `json:"allowed_tools,omitzero"`
  9328  	paramObj
  9329  }
  9330  
  9331  func (r BetaRequestMCPServerToolConfigurationParam) MarshalJSON() (data []byte, err error) {
  9332  	type shadow BetaRequestMCPServerToolConfigurationParam
  9333  	return param.MarshalObject(r, (*shadow)(&r))
  9334  }
  9335  func (r *BetaRequestMCPServerToolConfigurationParam) UnmarshalJSON(data []byte) error {
  9336  	return apijson.UnmarshalRoot(data, r)
  9337  }
  9338  
  9339  // The properties Name, Type, URL are required.
  9340  type BetaRequestMCPServerURLDefinitionParam struct {
  9341  	Name               string                                     `json:"name" api:"required"`
  9342  	URL                string                                     `json:"url" api:"required"`
  9343  	AuthorizationToken param.Opt[string]                          `json:"authorization_token,omitzero"`
  9344  	ToolConfiguration  BetaRequestMCPServerToolConfigurationParam `json:"tool_configuration,omitzero"`
  9345  	// This field can be elided, and will marshal its zero value as "url".
  9346  	Type constant.URL `json:"type" default:"url"`
  9347  	paramObj
  9348  }
  9349  
  9350  func (r BetaRequestMCPServerURLDefinitionParam) MarshalJSON() (data []byte, err error) {
  9351  	type shadow BetaRequestMCPServerURLDefinitionParam
  9352  	return param.MarshalObject(r, (*shadow)(&r))
  9353  }
  9354  func (r *BetaRequestMCPServerURLDefinitionParam) UnmarshalJSON(data []byte) error {
  9355  	return apijson.UnmarshalRoot(data, r)
  9356  }
  9357  
  9358  // The properties ToolUseID, Type are required.
  9359  type BetaRequestMCPToolResultBlockParam struct {
  9360  	ToolUseID string          `json:"tool_use_id" api:"required"`
  9361  	IsError   param.Opt[bool] `json:"is_error,omitzero"`
  9362  	// Create a cache control breakpoint at this content block.
  9363  	CacheControl BetaCacheControlEphemeralParam                 `json:"cache_control,omitzero"`
  9364  	Content      BetaRequestMCPToolResultBlockParamContentUnion `json:"content,omitzero"`
  9365  	// This field can be elided, and will marshal its zero value as "mcp_tool_result".
  9366  	Type constant.MCPToolResult `json:"type" default:"mcp_tool_result"`
  9367  	paramObj
  9368  }
  9369  
  9370  func (r BetaRequestMCPToolResultBlockParam) MarshalJSON() (data []byte, err error) {
  9371  	type shadow BetaRequestMCPToolResultBlockParam
  9372  	return param.MarshalObject(r, (*shadow)(&r))
  9373  }
  9374  func (r *BetaRequestMCPToolResultBlockParam) UnmarshalJSON(data []byte) error {
  9375  	return apijson.UnmarshalRoot(data, r)
  9376  }
  9377  
  9378  // Only one field can be non-zero.
  9379  //
  9380  // Use [param.IsOmitted] to confirm if a field is set.
  9381  type BetaRequestMCPToolResultBlockParamContentUnion struct {
  9382  	OfString                        param.Opt[string]    `json:",omitzero,inline"`
  9383  	OfBetaMCPToolResultBlockContent []BetaTextBlockParam `json:",omitzero,inline"`
  9384  	paramUnion
  9385  }
  9386  
  9387  func (u BetaRequestMCPToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
  9388  	return param.MarshalUnion(u, u.OfString, u.OfBetaMCPToolResultBlockContent)
  9389  }
  9390  func (u *BetaRequestMCPToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
  9391  	return apijson.UnmarshalRoot(data, u)
  9392  }
  9393  
  9394  func (u *BetaRequestMCPToolResultBlockParamContentUnion) asAny() any {
  9395  	if !param.IsOmitted(u.OfString) {
  9396  		return &u.OfString.Value
  9397  	} else if !param.IsOmitted(u.OfBetaMCPToolResultBlockContent) {
  9398  		return &u.OfBetaMCPToolResultBlockContent
  9399  	}
  9400  	return nil
  9401  }
  9402  
  9403  // Mid-conversation directive to surface a declared tool.
  9404  //
  9405  // `tool` references a tool (or MCP toolset) by name from the request's `tools`; it
  9406  // is offered to the model from this point in the conversation onward.
  9407  //
  9408  // The properties Tool, Type are required.
  9409  type BetaRequestToolAdditionBlockParam struct {
  9410  	// Reference to a single tool the caller declared directly in `tools[]`. Does not
  9411  	// accept the composed `{server}_{name}` form the server assigns to MCP-resolved
  9412  	// tools — use `mcp_tool_reference` or `mcp_toolset_reference` for those.
  9413  	Tool BetaRequestToolAdditionBlockToolUnionParam `json:"tool,omitzero" api:"required"`
  9414  	// Create a cache control breakpoint at this content block.
  9415  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  9416  	// This field can be elided, and will marshal its zero value as "tool_addition".
  9417  	Type constant.ToolAddition `json:"type" default:"tool_addition"`
  9418  	paramObj
  9419  }
  9420  
  9421  func (r BetaRequestToolAdditionBlockParam) MarshalJSON() (data []byte, err error) {
  9422  	type shadow BetaRequestToolAdditionBlockParam
  9423  	return param.MarshalObject(r, (*shadow)(&r))
  9424  }
  9425  func (r *BetaRequestToolAdditionBlockParam) UnmarshalJSON(data []byte) error {
  9426  	return apijson.UnmarshalRoot(data, r)
  9427  }
  9428  
  9429  // Only one field can be non-zero.
  9430  //
  9431  // Use [param.IsOmitted] to confirm if a field is set.
  9432  type BetaRequestToolAdditionBlockToolUnionParam struct {
  9433  	OfToolReference       *BetaToolChangeToolReferenceParam       `json:",omitzero,inline"`
  9434  	OfMCPToolReference    *BetaToolChangeMCPToolReferenceParam    `json:",omitzero,inline"`
  9435  	OfMCPToolsetReference *BetaToolChangeMCPToolsetReferenceParam `json:",omitzero,inline"`
  9436  	paramUnion
  9437  }
  9438  
  9439  func (u BetaRequestToolAdditionBlockToolUnionParam) MarshalJSON() ([]byte, error) {
  9440  	return param.MarshalUnion(u, u.OfToolReference, u.OfMCPToolReference, u.OfMCPToolsetReference)
  9441  }
  9442  func (u *BetaRequestToolAdditionBlockToolUnionParam) UnmarshalJSON(data []byte) error {
  9443  	return apijson.UnmarshalRoot(data, u)
  9444  }
  9445  
  9446  func (u *BetaRequestToolAdditionBlockToolUnionParam) asAny() any {
  9447  	if !param.IsOmitted(u.OfToolReference) {
  9448  		return u.OfToolReference
  9449  	} else if !param.IsOmitted(u.OfMCPToolReference) {
  9450  		return u.OfMCPToolReference
  9451  	} else if !param.IsOmitted(u.OfMCPToolsetReference) {
  9452  		return u.OfMCPToolsetReference
  9453  	}
  9454  	return nil
  9455  }
  9456  
  9457  // Returns a pointer to the underlying variant's property, if present.
  9458  func (u BetaRequestToolAdditionBlockToolUnionParam) GetName() *string {
  9459  	if vt := u.OfToolReference; vt != nil {
  9460  		return (*string)(&vt.Name)
  9461  	} else if vt := u.OfMCPToolReference; vt != nil {
  9462  		return (*string)(&vt.Name)
  9463  	}
  9464  	return nil
  9465  }
  9466  
  9467  // Returns a pointer to the underlying variant's property, if present.
  9468  func (u BetaRequestToolAdditionBlockToolUnionParam) GetType() *string {
  9469  	if vt := u.OfToolReference; vt != nil {
  9470  		return (*string)(&vt.Type)
  9471  	} else if vt := u.OfMCPToolReference; vt != nil {
  9472  		return (*string)(&vt.Type)
  9473  	} else if vt := u.OfMCPToolsetReference; vt != nil {
  9474  		return (*string)(&vt.Type)
  9475  	}
  9476  	return nil
  9477  }
  9478  
  9479  // Returns a pointer to the underlying variant's property, if present.
  9480  func (u BetaRequestToolAdditionBlockToolUnionParam) GetServerName() *string {
  9481  	if vt := u.OfMCPToolReference; vt != nil {
  9482  		return (*string)(&vt.ServerName)
  9483  	} else if vt := u.OfMCPToolsetReference; vt != nil {
  9484  		return (*string)(&vt.ServerName)
  9485  	}
  9486  	return nil
  9487  }
  9488  
  9489  func init() {
  9490  	apijson.RegisterUnion[BetaRequestToolAdditionBlockToolUnionParam](
  9491  		"type",
  9492  		apijson.Discriminator[BetaToolChangeToolReferenceParam]("tool_reference"),
  9493  		apijson.Discriminator[BetaToolChangeMCPToolReferenceParam]("mcp_tool_reference"),
  9494  		apijson.Discriminator[BetaToolChangeMCPToolsetReferenceParam]("mcp_toolset_reference"),
  9495  	)
  9496  }
  9497  
  9498  // Mid-conversation directive to withdraw a tool.
  9499  //
  9500  // `tool` references a tool (or MCP toolset) by name from the request's `tools`; it
  9501  // is no longer offered to the model from this point in the conversation onward.
  9502  //
  9503  // The properties Tool, Type are required.
  9504  type BetaRequestToolRemovalBlockParam struct {
  9505  	// Reference to a single tool the caller declared directly in `tools[]`. Does not
  9506  	// accept the composed `{server}_{name}` form the server assigns to MCP-resolved
  9507  	// tools — use `mcp_tool_reference` or `mcp_toolset_reference` for those.
  9508  	Tool BetaRequestToolRemovalBlockToolUnionParam `json:"tool,omitzero" api:"required"`
  9509  	// Create a cache control breakpoint at this content block.
  9510  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  9511  	// This field can be elided, and will marshal its zero value as "tool_removal".
  9512  	Type constant.ToolRemoval `json:"type" default:"tool_removal"`
  9513  	paramObj
  9514  }
  9515  
  9516  func (r BetaRequestToolRemovalBlockParam) MarshalJSON() (data []byte, err error) {
  9517  	type shadow BetaRequestToolRemovalBlockParam
  9518  	return param.MarshalObject(r, (*shadow)(&r))
  9519  }
  9520  func (r *BetaRequestToolRemovalBlockParam) UnmarshalJSON(data []byte) error {
  9521  	return apijson.UnmarshalRoot(data, r)
  9522  }
  9523  
  9524  // Only one field can be non-zero.
  9525  //
  9526  // Use [param.IsOmitted] to confirm if a field is set.
  9527  type BetaRequestToolRemovalBlockToolUnionParam struct {
  9528  	OfToolReference       *BetaToolChangeToolReferenceParam       `json:",omitzero,inline"`
  9529  	OfMCPToolReference    *BetaToolChangeMCPToolReferenceParam    `json:",omitzero,inline"`
  9530  	OfMCPToolsetReference *BetaToolChangeMCPToolsetReferenceParam `json:",omitzero,inline"`
  9531  	paramUnion
  9532  }
  9533  
  9534  func (u BetaRequestToolRemovalBlockToolUnionParam) MarshalJSON() ([]byte, error) {
  9535  	return param.MarshalUnion(u, u.OfToolReference, u.OfMCPToolReference, u.OfMCPToolsetReference)
  9536  }
  9537  func (u *BetaRequestToolRemovalBlockToolUnionParam) UnmarshalJSON(data []byte) error {
  9538  	return apijson.UnmarshalRoot(data, u)
  9539  }
  9540  
  9541  func (u *BetaRequestToolRemovalBlockToolUnionParam) asAny() any {
  9542  	if !param.IsOmitted(u.OfToolReference) {
  9543  		return u.OfToolReference
  9544  	} else if !param.IsOmitted(u.OfMCPToolReference) {
  9545  		return u.OfMCPToolReference
  9546  	} else if !param.IsOmitted(u.OfMCPToolsetReference) {
  9547  		return u.OfMCPToolsetReference
  9548  	}
  9549  	return nil
  9550  }
  9551  
  9552  // Returns a pointer to the underlying variant's property, if present.
  9553  func (u BetaRequestToolRemovalBlockToolUnionParam) GetName() *string {
  9554  	if vt := u.OfToolReference; vt != nil {
  9555  		return (*string)(&vt.Name)
  9556  	} else if vt := u.OfMCPToolReference; vt != nil {
  9557  		return (*string)(&vt.Name)
  9558  	}
  9559  	return nil
  9560  }
  9561  
  9562  // Returns a pointer to the underlying variant's property, if present.
  9563  func (u BetaRequestToolRemovalBlockToolUnionParam) GetType() *string {
  9564  	if vt := u.OfToolReference; vt != nil {
  9565  		return (*string)(&vt.Type)
  9566  	} else if vt := u.OfMCPToolReference; vt != nil {
  9567  		return (*string)(&vt.Type)
  9568  	} else if vt := u.OfMCPToolsetReference; vt != nil {
  9569  		return (*string)(&vt.Type)
  9570  	}
  9571  	return nil
  9572  }
  9573  
  9574  // Returns a pointer to the underlying variant's property, if present.
  9575  func (u BetaRequestToolRemovalBlockToolUnionParam) GetServerName() *string {
  9576  	if vt := u.OfMCPToolReference; vt != nil {
  9577  		return (*string)(&vt.ServerName)
  9578  	} else if vt := u.OfMCPToolsetReference; vt != nil {
  9579  		return (*string)(&vt.ServerName)
  9580  	}
  9581  	return nil
  9582  }
  9583  
  9584  func init() {
  9585  	apijson.RegisterUnion[BetaRequestToolRemovalBlockToolUnionParam](
  9586  		"type",
  9587  		apijson.Discriminator[BetaToolChangeToolReferenceParam]("tool_reference"),
  9588  		apijson.Discriminator[BetaToolChangeMCPToolReferenceParam]("mcp_tool_reference"),
  9589  		apijson.Discriminator[BetaToolChangeMCPToolsetReferenceParam]("mcp_toolset_reference"),
  9590  	)
  9591  }
  9592  
  9593  // The properties Content, Source, Title, Type are required.
  9594  type BetaSearchResultBlockParam struct {
  9595  	Content []BetaTextBlockParam `json:"content,omitzero" api:"required"`
  9596  	Source  string               `json:"source" api:"required"`
  9597  	Title   string               `json:"title" api:"required"`
  9598  	// Create a cache control breakpoint at this content block.
  9599  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  9600  	Citations    BetaCitationsConfigParam       `json:"citations,omitzero"`
  9601  	// This field can be elided, and will marshal its zero value as "search_result".
  9602  	Type constant.SearchResult `json:"type" default:"search_result"`
  9603  	paramObj
  9604  }
  9605  
  9606  func (r BetaSearchResultBlockParam) MarshalJSON() (data []byte, err error) {
  9607  	type shadow BetaSearchResultBlockParam
  9608  	return param.MarshalObject(r, (*shadow)(&r))
  9609  }
  9610  func (r *BetaSearchResultBlockParam) UnmarshalJSON(data []byte) error {
  9611  	return apijson.UnmarshalRoot(data, r)
  9612  }
  9613  
  9614  // Tool invocation generated by a server-side tool.
  9615  type BetaServerToolCaller struct {
  9616  	ToolID string                         `json:"tool_id" api:"required"`
  9617  	Type   constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
  9618  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  9619  	JSON struct {
  9620  		ToolID      respjson.Field
  9621  		Type        respjson.Field
  9622  		ExtraFields map[string]respjson.Field
  9623  		raw         string
  9624  	} `json:"-"`
  9625  }
  9626  
  9627  // Returns the unmodified JSON received from the API
  9628  func (r BetaServerToolCaller) RawJSON() string { return r.JSON.raw }
  9629  func (r *BetaServerToolCaller) UnmarshalJSON(data []byte) error {
  9630  	return apijson.UnmarshalRoot(data, r)
  9631  }
  9632  
  9633  // ToParam converts this BetaServerToolCaller to a BetaServerToolCallerParam.
  9634  //
  9635  // Warning: the fields of the param type will not be present. ToParam should only
  9636  // be used at the last possible moment before sending a request. Test for this with
  9637  // BetaServerToolCallerParam.Overrides()
  9638  func (r BetaServerToolCaller) ToParam() BetaServerToolCallerParam {
  9639  	return param.Override[BetaServerToolCallerParam](json.RawMessage(r.RawJSON()))
  9640  }
  9641  
  9642  // Tool invocation generated by a server-side tool.
  9643  //
  9644  // The properties ToolID, Type are required.
  9645  type BetaServerToolCallerParam struct {
  9646  	ToolID string `json:"tool_id" api:"required"`
  9647  	// This field can be elided, and will marshal its zero value as
  9648  	// "code_execution_20250825".
  9649  	Type constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
  9650  	paramObj
  9651  }
  9652  
  9653  func (r BetaServerToolCallerParam) MarshalJSON() (data []byte, err error) {
  9654  	type shadow BetaServerToolCallerParam
  9655  	return param.MarshalObject(r, (*shadow)(&r))
  9656  }
  9657  func (r *BetaServerToolCallerParam) UnmarshalJSON(data []byte) error {
  9658  	return apijson.UnmarshalRoot(data, r)
  9659  }
  9660  
  9661  type BetaServerToolCaller20260120 struct {
  9662  	ToolID string                         `json:"tool_id" api:"required"`
  9663  	Type   constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
  9664  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  9665  	JSON struct {
  9666  		ToolID      respjson.Field
  9667  		Type        respjson.Field
  9668  		ExtraFields map[string]respjson.Field
  9669  		raw         string
  9670  	} `json:"-"`
  9671  }
  9672  
  9673  // Returns the unmodified JSON received from the API
  9674  func (r BetaServerToolCaller20260120) RawJSON() string { return r.JSON.raw }
  9675  func (r *BetaServerToolCaller20260120) UnmarshalJSON(data []byte) error {
  9676  	return apijson.UnmarshalRoot(data, r)
  9677  }
  9678  
  9679  // ToParam converts this BetaServerToolCaller20260120 to a
  9680  // BetaServerToolCaller20260120Param.
  9681  //
  9682  // Warning: the fields of the param type will not be present. ToParam should only
  9683  // be used at the last possible moment before sending a request. Test for this with
  9684  // BetaServerToolCaller20260120Param.Overrides()
  9685  func (r BetaServerToolCaller20260120) ToParam() BetaServerToolCaller20260120Param {
  9686  	return param.Override[BetaServerToolCaller20260120Param](json.RawMessage(r.RawJSON()))
  9687  }
  9688  
  9689  // The properties ToolID, Type are required.
  9690  type BetaServerToolCaller20260120Param struct {
  9691  	ToolID string `json:"tool_id" api:"required"`
  9692  	// This field can be elided, and will marshal its zero value as
  9693  	// "code_execution_20260120".
  9694  	Type constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
  9695  	paramObj
  9696  }
  9697  
  9698  func (r BetaServerToolCaller20260120Param) MarshalJSON() (data []byte, err error) {
  9699  	type shadow BetaServerToolCaller20260120Param
  9700  	return param.MarshalObject(r, (*shadow)(&r))
  9701  }
  9702  func (r *BetaServerToolCaller20260120Param) UnmarshalJSON(data []byte) error {
  9703  	return apijson.UnmarshalRoot(data, r)
  9704  }
  9705  
  9706  type BetaServerToolUsage struct {
  9707  	// The number of web fetch tool requests.
  9708  	WebFetchRequests int64 `json:"web_fetch_requests" api:"required"`
  9709  	// The number of web search tool requests.
  9710  	WebSearchRequests int64 `json:"web_search_requests" api:"required"`
  9711  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  9712  	JSON struct {
  9713  		WebFetchRequests  respjson.Field
  9714  		WebSearchRequests respjson.Field
  9715  		ExtraFields       map[string]respjson.Field
  9716  		raw               string
  9717  	} `json:"-"`
  9718  }
  9719  
  9720  // Returns the unmodified JSON received from the API
  9721  func (r BetaServerToolUsage) RawJSON() string { return r.JSON.raw }
  9722  func (r *BetaServerToolUsage) UnmarshalJSON(data []byte) error {
  9723  	return apijson.UnmarshalRoot(data, r)
  9724  }
  9725  
  9726  type BetaServerToolUseBlock struct {
  9727  	ID    string `json:"id" api:"required"`
  9728  	Input any    `json:"input" api:"required"`
  9729  	// Any of "advisor", "web_search", "web_fetch", "code_execution",
  9730  	// "bash_code_execution", "text_editor_code_execution", "tool_search_tool_regex",
  9731  	// "tool_search_tool_bm25".
  9732  	Name BetaServerToolUseBlockName `json:"name" api:"required"`
  9733  	Type constant.ServerToolUse     `json:"type" default:"server_tool_use"`
  9734  	// Tool invocation directly from the model.
  9735  	Caller BetaServerToolUseBlockCallerUnion `json:"caller"`
  9736  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  9737  	JSON struct {
  9738  		ID          respjson.Field
  9739  		Input       respjson.Field
  9740  		Name        respjson.Field
  9741  		Type        respjson.Field
  9742  		Caller      respjson.Field
  9743  		ExtraFields map[string]respjson.Field
  9744  		raw         string
  9745  	} `json:"-"`
  9746  }
  9747  
  9748  // Returns the unmodified JSON received from the API
  9749  func (r BetaServerToolUseBlock) RawJSON() string { return r.JSON.raw }
  9750  func (r *BetaServerToolUseBlock) UnmarshalJSON(data []byte) error {
  9751  	return apijson.UnmarshalRoot(data, r)
  9752  }
  9753  
  9754  type BetaServerToolUseBlockName string
  9755  
  9756  const (
  9757  	BetaServerToolUseBlockNameAdvisor                 BetaServerToolUseBlockName = "advisor"
  9758  	BetaServerToolUseBlockNameWebSearch               BetaServerToolUseBlockName = "web_search"
  9759  	BetaServerToolUseBlockNameWebFetch                BetaServerToolUseBlockName = "web_fetch"
  9760  	BetaServerToolUseBlockNameCodeExecution           BetaServerToolUseBlockName = "code_execution"
  9761  	BetaServerToolUseBlockNameBashCodeExecution       BetaServerToolUseBlockName = "bash_code_execution"
  9762  	BetaServerToolUseBlockNameTextEditorCodeExecution BetaServerToolUseBlockName = "text_editor_code_execution"
  9763  	BetaServerToolUseBlockNameToolSearchToolRegex     BetaServerToolUseBlockName = "tool_search_tool_regex"
  9764  	BetaServerToolUseBlockNameToolSearchToolBm25      BetaServerToolUseBlockName = "tool_search_tool_bm25"
  9765  )
  9766  
  9767  // BetaServerToolUseBlockCallerUnion contains all possible properties and values
  9768  // from [BetaDirectCaller], [BetaServerToolCaller], [BetaServerToolCaller20260120].
  9769  //
  9770  // Use the [BetaServerToolUseBlockCallerUnion.AsAny] method to switch on the
  9771  // variant.
  9772  //
  9773  // Use the methods beginning with 'As' to cast the union to one of its variants.
  9774  type BetaServerToolUseBlockCallerUnion struct {
  9775  	// Any of "direct", "code_execution_20250825", "code_execution_20260120".
  9776  	Type   string `json:"type"`
  9777  	ToolID string `json:"tool_id"`
  9778  	JSON   struct {
  9779  		Type   respjson.Field
  9780  		ToolID respjson.Field
  9781  		raw    string
  9782  	} `json:"-"`
  9783  }
  9784  
  9785  // anyBetaServerToolUseBlockCaller is implemented by each variant of
  9786  // [BetaServerToolUseBlockCallerUnion] to add type safety for the return type of
  9787  // [BetaServerToolUseBlockCallerUnion.AsAny]
  9788  type anyBetaServerToolUseBlockCaller interface {
  9789  	implBetaServerToolUseBlockCallerUnion()
  9790  }
  9791  
  9792  func (BetaDirectCaller) implBetaServerToolUseBlockCallerUnion()             {}
  9793  func (BetaServerToolCaller) implBetaServerToolUseBlockCallerUnion()         {}
  9794  func (BetaServerToolCaller20260120) implBetaServerToolUseBlockCallerUnion() {}
  9795  
  9796  // Use the following switch statement to find the correct variant
  9797  //
  9798  //	switch variant := BetaServerToolUseBlockCallerUnion.AsAny().(type) {
  9799  //	case anthropic.BetaDirectCaller:
  9800  //	case anthropic.BetaServerToolCaller:
  9801  //	case anthropic.BetaServerToolCaller20260120:
  9802  //	default:
  9803  //	  fmt.Errorf("no variant present")
  9804  //	}
  9805  func (u BetaServerToolUseBlockCallerUnion) AsAny() anyBetaServerToolUseBlockCaller {
  9806  	switch u.Type {
  9807  	case "direct":
  9808  		return u.AsDirect()
  9809  	case "code_execution_20250825":
  9810  		return u.AsCodeExecution20250825()
  9811  	case "code_execution_20260120":
  9812  		return u.AsCodeExecution20260120()
  9813  	}
  9814  	return nil
  9815  }
  9816  
  9817  func (u BetaServerToolUseBlockCallerUnion) AsDirect() (v BetaDirectCaller) {
  9818  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  9819  	return
  9820  }
  9821  
  9822  func (u BetaServerToolUseBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller) {
  9823  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  9824  	return
  9825  }
  9826  
  9827  func (u BetaServerToolUseBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120) {
  9828  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  9829  	return
  9830  }
  9831  
  9832  // Returns the unmodified JSON received from the API
  9833  func (u BetaServerToolUseBlockCallerUnion) RawJSON() string { return u.JSON.raw }
  9834  
  9835  func (r *BetaServerToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error {
  9836  	return apijson.UnmarshalRoot(data, r)
  9837  }
  9838  
  9839  // The properties ID, Input, Name, Type are required.
  9840  type BetaServerToolUseBlockParam struct {
  9841  	ID    string `json:"id" api:"required"`
  9842  	Input any    `json:"input,omitzero" api:"required"`
  9843  	// Any of "advisor", "web_search", "web_fetch", "code_execution",
  9844  	// "bash_code_execution", "text_editor_code_execution", "tool_search_tool_regex",
  9845  	// "tool_search_tool_bm25".
  9846  	Name BetaServerToolUseBlockParamName `json:"name,omitzero" api:"required"`
  9847  	// Create a cache control breakpoint at this content block.
  9848  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
  9849  	// Tool invocation directly from the model.
  9850  	Caller BetaServerToolUseBlockParamCallerUnion `json:"caller,omitzero"`
  9851  	// This field can be elided, and will marshal its zero value as "server_tool_use".
  9852  	Type constant.ServerToolUse `json:"type" default:"server_tool_use"`
  9853  	paramObj
  9854  }
  9855  
  9856  func (r BetaServerToolUseBlockParam) MarshalJSON() (data []byte, err error) {
  9857  	type shadow BetaServerToolUseBlockParam
  9858  	return param.MarshalObject(r, (*shadow)(&r))
  9859  }
  9860  func (r *BetaServerToolUseBlockParam) UnmarshalJSON(data []byte) error {
  9861  	return apijson.UnmarshalRoot(data, r)
  9862  }
  9863  
  9864  type BetaServerToolUseBlockParamName string
  9865  
  9866  const (
  9867  	BetaServerToolUseBlockParamNameAdvisor                 BetaServerToolUseBlockParamName = "advisor"
  9868  	BetaServerToolUseBlockParamNameWebSearch               BetaServerToolUseBlockParamName = "web_search"
  9869  	BetaServerToolUseBlockParamNameWebFetch                BetaServerToolUseBlockParamName = "web_fetch"
  9870  	BetaServerToolUseBlockParamNameCodeExecution           BetaServerToolUseBlockParamName = "code_execution"
  9871  	BetaServerToolUseBlockParamNameBashCodeExecution       BetaServerToolUseBlockParamName = "bash_code_execution"
  9872  	BetaServerToolUseBlockParamNameTextEditorCodeExecution BetaServerToolUseBlockParamName = "text_editor_code_execution"
  9873  	BetaServerToolUseBlockParamNameToolSearchToolRegex     BetaServerToolUseBlockParamName = "tool_search_tool_regex"
  9874  	BetaServerToolUseBlockParamNameToolSearchToolBm25      BetaServerToolUseBlockParamName = "tool_search_tool_bm25"
  9875  )
  9876  
  9877  // Only one field can be non-zero.
  9878  //
  9879  // Use [param.IsOmitted] to confirm if a field is set.
  9880  type BetaServerToolUseBlockParamCallerUnion struct {
  9881  	OfDirect                *BetaDirectCallerParam             `json:",omitzero,inline"`
  9882  	OfCodeExecution20250825 *BetaServerToolCallerParam         `json:",omitzero,inline"`
  9883  	OfCodeExecution20260120 *BetaServerToolCaller20260120Param `json:",omitzero,inline"`
  9884  	paramUnion
  9885  }
  9886  
  9887  func (u BetaServerToolUseBlockParamCallerUnion) MarshalJSON() ([]byte, error) {
  9888  	return param.MarshalUnion(u, u.OfDirect, u.OfCodeExecution20250825, u.OfCodeExecution20260120)
  9889  }
  9890  func (u *BetaServerToolUseBlockParamCallerUnion) UnmarshalJSON(data []byte) error {
  9891  	return apijson.UnmarshalRoot(data, u)
  9892  }
  9893  
  9894  func (u *BetaServerToolUseBlockParamCallerUnion) asAny() any {
  9895  	if !param.IsOmitted(u.OfDirect) {
  9896  		return u.OfDirect
  9897  	} else if !param.IsOmitted(u.OfCodeExecution20250825) {
  9898  		return u.OfCodeExecution20250825
  9899  	} else if !param.IsOmitted(u.OfCodeExecution20260120) {
  9900  		return u.OfCodeExecution20260120
  9901  	}
  9902  	return nil
  9903  }
  9904  
  9905  // Returns a pointer to the underlying variant's property, if present.
  9906  func (u BetaServerToolUseBlockParamCallerUnion) GetType() *string {
  9907  	if vt := u.OfDirect; vt != nil {
  9908  		return (*string)(&vt.Type)
  9909  	} else if vt := u.OfCodeExecution20250825; vt != nil {
  9910  		return (*string)(&vt.Type)
  9911  	} else if vt := u.OfCodeExecution20260120; vt != nil {
  9912  		return (*string)(&vt.Type)
  9913  	}
  9914  	return nil
  9915  }
  9916  
  9917  // Returns a pointer to the underlying variant's property, if present.
  9918  func (u BetaServerToolUseBlockParamCallerUnion) GetToolID() *string {
  9919  	if vt := u.OfCodeExecution20250825; vt != nil {
  9920  		return (*string)(&vt.ToolID)
  9921  	} else if vt := u.OfCodeExecution20260120; vt != nil {
  9922  		return (*string)(&vt.ToolID)
  9923  	}
  9924  	return nil
  9925  }
  9926  
  9927  func init() {
  9928  	apijson.RegisterUnion[BetaServerToolUseBlockParamCallerUnion](
  9929  		"type",
  9930  		apijson.Discriminator[BetaDirectCallerParam]("direct"),
  9931  		apijson.Discriminator[BetaServerToolCallerParam]("code_execution_20250825"),
  9932  		apijson.Discriminator[BetaServerToolCaller20260120Param]("code_execution_20260120"),
  9933  	)
  9934  }
  9935  
  9936  type BetaSignatureDelta struct {
  9937  	// The `signature` for this thinking block: an opaque value used to verify that the
  9938  	// block was generated by Claude when it is passed back to the API. Delivered in a
  9939  	// `signature_delta` event just before the block's `content_block_stop` event.
  9940  	Signature string                  `json:"signature" api:"required"`
  9941  	Type      constant.SignatureDelta `json:"type" default:"signature_delta"`
  9942  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  9943  	JSON struct {
  9944  		Signature   respjson.Field
  9945  		Type        respjson.Field
  9946  		ExtraFields map[string]respjson.Field
  9947  		raw         string
  9948  	} `json:"-"`
  9949  }
  9950  
  9951  // Returns the unmodified JSON received from the API
  9952  func (r BetaSignatureDelta) RawJSON() string { return r.JSON.raw }
  9953  func (r *BetaSignatureDelta) UnmarshalJSON(data []byte) error {
  9954  	return apijson.UnmarshalRoot(data, r)
  9955  }
  9956  
  9957  // Specification for a skill to be loaded in a container (request model).
  9958  //
  9959  // The properties SkillID, Type are required.
  9960  type BetaSkillParams struct {
  9961  	// Skill ID
  9962  	SkillID string `json:"skill_id" api:"required"`
  9963  	// Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
  9964  	//
  9965  	// Any of "anthropic", "custom".
  9966  	Type BetaSkillParamsType `json:"type,omitzero" api:"required"`
  9967  	// Skill version or 'latest' for most recent version
  9968  	Version param.Opt[string] `json:"version,omitzero"`
  9969  	paramObj
  9970  }
  9971  
  9972  func (r BetaSkillParams) MarshalJSON() (data []byte, err error) {
  9973  	type shadow BetaSkillParams
  9974  	return param.MarshalObject(r, (*shadow)(&r))
  9975  }
  9976  func (r *BetaSkillParams) UnmarshalJSON(data []byte) error {
  9977  	return apijson.UnmarshalRoot(data, r)
  9978  }
  9979  
  9980  // Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
  9981  type BetaSkillParamsType string
  9982  
  9983  const (
  9984  	BetaSkillParamsTypeAnthropic BetaSkillParamsType = "anthropic"
  9985  	BetaSkillParamsTypeCustom    BetaSkillParamsType = "custom"
  9986  )
  9987  
  9988  type BetaStopReason string
  9989  
  9990  const (
  9991  	BetaStopReasonEndTurn                    BetaStopReason = "end_turn"
  9992  	BetaStopReasonMaxTokens                  BetaStopReason = "max_tokens"
  9993  	BetaStopReasonStopSequence               BetaStopReason = "stop_sequence"
  9994  	BetaStopReasonToolUse                    BetaStopReason = "tool_use"
  9995  	BetaStopReasonPauseTurn                  BetaStopReason = "pause_turn"
  9996  	BetaStopReasonCompaction                 BetaStopReason = "compaction"
  9997  	BetaStopReasonRefusal                    BetaStopReason = "refusal"
  9998  	BetaStopReasonModelContextWindowExceeded BetaStopReason = "model_context_window_exceeded"
  9999  )
 10000  
 10001  // Per-message output configuration on a role:"system" input message.
 10002  //
 10003  // Fields here apply per-turn; `format` remains top-level only. An empty `{}` is
 10004  // accepted on a message that carries content; a message with neither content nor
 10005  // output_config fields is rejected.
 10006  type BetaSystemMessageOutputConfigParam struct {
 10007  	// All possible effort levels.
 10008  	//
 10009  	// Any of "low", "medium", "high", "xhigh", "max".
 10010  	Effort BetaSystemMessageOutputConfigEffort `json:"effort,omitzero"`
 10011  	paramObj
 10012  }
 10013  
 10014  func (r BetaSystemMessageOutputConfigParam) MarshalJSON() (data []byte, err error) {
 10015  	type shadow BetaSystemMessageOutputConfigParam
 10016  	return param.MarshalObject(r, (*shadow)(&r))
 10017  }
 10018  func (r *BetaSystemMessageOutputConfigParam) UnmarshalJSON(data []byte) error {
 10019  	return apijson.UnmarshalRoot(data, r)
 10020  }
 10021  
 10022  // All possible effort levels.
 10023  type BetaSystemMessageOutputConfigEffort string
 10024  
 10025  const (
 10026  	BetaSystemMessageOutputConfigEffortLow    BetaSystemMessageOutputConfigEffort = "low"
 10027  	BetaSystemMessageOutputConfigEffortMedium BetaSystemMessageOutputConfigEffort = "medium"
 10028  	BetaSystemMessageOutputConfigEffortHigh   BetaSystemMessageOutputConfigEffort = "high"
 10029  	BetaSystemMessageOutputConfigEffortXhigh  BetaSystemMessageOutputConfigEffort = "xhigh"
 10030  	BetaSystemMessageOutputConfigEffortMax    BetaSystemMessageOutputConfigEffort = "max"
 10031  )
 10032  
 10033  type BetaTextBlock struct {
 10034  	// Citations supporting the text block.
 10035  	//
 10036  	// The type of citation returned will depend on the type of document being cited.
 10037  	// Citing a PDF results in `page_location`, plain text results in `char_location`,
 10038  	// and content document results in `content_block_location`.
 10039  	Citations []BetaTextCitationUnion `json:"citations" api:"required"`
 10040  	Text      string                  `json:"text" api:"required"`
 10041  	Type      constant.Text           `json:"type" default:"text"`
 10042  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 10043  	JSON struct {
 10044  		Citations   respjson.Field
 10045  		Text        respjson.Field
 10046  		Type        respjson.Field
 10047  		ExtraFields map[string]respjson.Field
 10048  		raw         string
 10049  	} `json:"-"`
 10050  }
 10051  
 10052  // Returns the unmodified JSON received from the API
 10053  func (r BetaTextBlock) RawJSON() string { return r.JSON.raw }
 10054  func (r *BetaTextBlock) UnmarshalJSON(data []byte) error {
 10055  	return apijson.UnmarshalRoot(data, r)
 10056  }
 10057  
 10058  // The properties Text, Type are required.
 10059  type BetaTextBlockParam struct {
 10060  	Text      string                       `json:"text" api:"required"`
 10061  	Citations []BetaTextCitationParamUnion `json:"citations,omitzero"`
 10062  	// Create a cache control breakpoint at this content block.
 10063  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 10064  	// This field can be elided, and will marshal its zero value as "text".
 10065  	Type constant.Text `json:"type" default:"text"`
 10066  	paramObj
 10067  }
 10068  
 10069  func (r BetaTextBlockParam) MarshalJSON() (data []byte, err error) {
 10070  	type shadow BetaTextBlockParam
 10071  	return param.MarshalObject(r, (*shadow)(&r))
 10072  }
 10073  func (r *BetaTextBlockParam) UnmarshalJSON(data []byte) error {
 10074  	return apijson.UnmarshalRoot(data, r)
 10075  }
 10076  
 10077  // BetaTextCitationUnion contains all possible properties and values from
 10078  // [BetaCitationCharLocation], [BetaCitationPageLocation],
 10079  // [BetaCitationContentBlockLocation], [BetaCitationsWebSearchResultLocation],
 10080  // [BetaCitationSearchResultLocation].
 10081  //
 10082  // Use the [BetaTextCitationUnion.AsAny] method to switch on the variant.
 10083  //
 10084  // Use the methods beginning with 'As' to cast the union to one of its variants.
 10085  type BetaTextCitationUnion struct {
 10086  	CitedText     string `json:"cited_text"`
 10087  	DocumentIndex int64  `json:"document_index"`
 10088  	DocumentTitle string `json:"document_title"`
 10089  	// This field is from variant [BetaCitationCharLocation].
 10090  	EndCharIndex int64  `json:"end_char_index"`
 10091  	FileID       string `json:"file_id"`
 10092  	// This field is from variant [BetaCitationCharLocation].
 10093  	StartCharIndex int64 `json:"start_char_index"`
 10094  	// Any of "char_location", "page_location", "content_block_location",
 10095  	// "web_search_result_location", "search_result_location".
 10096  	Type string `json:"type"`
 10097  	// This field is from variant [BetaCitationPageLocation].
 10098  	EndPageNumber int64 `json:"end_page_number"`
 10099  	// This field is from variant [BetaCitationPageLocation].
 10100  	StartPageNumber int64 `json:"start_page_number"`
 10101  	EndBlockIndex   int64 `json:"end_block_index"`
 10102  	StartBlockIndex int64 `json:"start_block_index"`
 10103  	// This field is from variant [BetaCitationsWebSearchResultLocation].
 10104  	EncryptedIndex string `json:"encrypted_index"`
 10105  	Title          string `json:"title"`
 10106  	// This field is from variant [BetaCitationsWebSearchResultLocation].
 10107  	URL string `json:"url"`
 10108  	// This field is from variant [BetaCitationSearchResultLocation].
 10109  	SearchResultIndex int64 `json:"search_result_index"`
 10110  	// This field is from variant [BetaCitationSearchResultLocation].
 10111  	Source string `json:"source"`
 10112  	JSON   struct {
 10113  		CitedText         respjson.Field
 10114  		DocumentIndex     respjson.Field
 10115  		DocumentTitle     respjson.Field
 10116  		EndCharIndex      respjson.Field
 10117  		FileID            respjson.Field
 10118  		StartCharIndex    respjson.Field
 10119  		Type              respjson.Field
 10120  		EndPageNumber     respjson.Field
 10121  		StartPageNumber   respjson.Field
 10122  		EndBlockIndex     respjson.Field
 10123  		StartBlockIndex   respjson.Field
 10124  		EncryptedIndex    respjson.Field
 10125  		Title             respjson.Field
 10126  		URL               respjson.Field
 10127  		SearchResultIndex respjson.Field
 10128  		Source            respjson.Field
 10129  		raw               string
 10130  	} `json:"-"`
 10131  }
 10132  
 10133  // anyBetaTextCitation is implemented by each variant of [BetaTextCitationUnion] to
 10134  // add type safety for the return type of [BetaTextCitationUnion.AsAny]
 10135  type anyBetaTextCitation interface {
 10136  	implBetaTextCitationUnion()
 10137  	toParamUnion() BetaTextCitationParamUnion
 10138  }
 10139  
 10140  func (BetaCitationCharLocation) implBetaTextCitationUnion()             {}
 10141  func (BetaCitationPageLocation) implBetaTextCitationUnion()             {}
 10142  func (BetaCitationContentBlockLocation) implBetaTextCitationUnion()     {}
 10143  func (BetaCitationsWebSearchResultLocation) implBetaTextCitationUnion() {}
 10144  func (BetaCitationSearchResultLocation) implBetaTextCitationUnion()     {}
 10145  
 10146  // Use the following switch statement to find the correct variant
 10147  //
 10148  //	switch variant := BetaTextCitationUnion.AsAny().(type) {
 10149  //	case anthropic.BetaCitationCharLocation:
 10150  //	case anthropic.BetaCitationPageLocation:
 10151  //	case anthropic.BetaCitationContentBlockLocation:
 10152  //	case anthropic.BetaCitationsWebSearchResultLocation:
 10153  //	case anthropic.BetaCitationSearchResultLocation:
 10154  //	default:
 10155  //	  fmt.Errorf("no variant present")
 10156  //	}
 10157  func (u BetaTextCitationUnion) AsAny() anyBetaTextCitation {
 10158  	switch u.Type {
 10159  	case "char_location":
 10160  		return u.AsCharLocation()
 10161  	case "page_location":
 10162  		return u.AsPageLocation()
 10163  	case "content_block_location":
 10164  		return u.AsContentBlockLocation()
 10165  	case "web_search_result_location":
 10166  		return u.AsWebSearchResultLocation()
 10167  	case "search_result_location":
 10168  		return u.AsSearchResultLocation()
 10169  	}
 10170  	return nil
 10171  }
 10172  
 10173  func (u BetaTextCitationUnion) AsCharLocation() (v BetaCitationCharLocation) {
 10174  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10175  	return
 10176  }
 10177  
 10178  func (u BetaTextCitationUnion) AsPageLocation() (v BetaCitationPageLocation) {
 10179  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10180  	return
 10181  }
 10182  
 10183  func (u BetaTextCitationUnion) AsContentBlockLocation() (v BetaCitationContentBlockLocation) {
 10184  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10185  	return
 10186  }
 10187  
 10188  func (u BetaTextCitationUnion) AsWebSearchResultLocation() (v BetaCitationsWebSearchResultLocation) {
 10189  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10190  	return
 10191  }
 10192  
 10193  func (u BetaTextCitationUnion) AsSearchResultLocation() (v BetaCitationSearchResultLocation) {
 10194  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10195  	return
 10196  }
 10197  
 10198  // Returns the unmodified JSON received from the API
 10199  func (u BetaTextCitationUnion) RawJSON() string { return u.JSON.raw }
 10200  
 10201  func (r *BetaTextCitationUnion) UnmarshalJSON(data []byte) error {
 10202  	return apijson.UnmarshalRoot(data, r)
 10203  }
 10204  
 10205  // Only one field can be non-zero.
 10206  //
 10207  // Use [param.IsOmitted] to confirm if a field is set.
 10208  type BetaTextCitationParamUnion struct {
 10209  	OfCharLocation            *BetaCitationCharLocationParam            `json:",omitzero,inline"`
 10210  	OfPageLocation            *BetaCitationPageLocationParam            `json:",omitzero,inline"`
 10211  	OfContentBlockLocation    *BetaCitationContentBlockLocationParam    `json:",omitzero,inline"`
 10212  	OfWebSearchResultLocation *BetaCitationWebSearchResultLocationParam `json:",omitzero,inline"`
 10213  	OfSearchResultLocation    *BetaCitationSearchResultLocationParam    `json:",omitzero,inline"`
 10214  	paramUnion
 10215  }
 10216  
 10217  func (u BetaTextCitationParamUnion) MarshalJSON() ([]byte, error) {
 10218  	return param.MarshalUnion(u, u.OfCharLocation,
 10219  		u.OfPageLocation,
 10220  		u.OfContentBlockLocation,
 10221  		u.OfWebSearchResultLocation,
 10222  		u.OfSearchResultLocation)
 10223  }
 10224  func (u *BetaTextCitationParamUnion) UnmarshalJSON(data []byte) error {
 10225  	return apijson.UnmarshalRoot(data, u)
 10226  }
 10227  
 10228  func (u *BetaTextCitationParamUnion) asAny() any {
 10229  	if !param.IsOmitted(u.OfCharLocation) {
 10230  		return u.OfCharLocation
 10231  	} else if !param.IsOmitted(u.OfPageLocation) {
 10232  		return u.OfPageLocation
 10233  	} else if !param.IsOmitted(u.OfContentBlockLocation) {
 10234  		return u.OfContentBlockLocation
 10235  	} else if !param.IsOmitted(u.OfWebSearchResultLocation) {
 10236  		return u.OfWebSearchResultLocation
 10237  	} else if !param.IsOmitted(u.OfSearchResultLocation) {
 10238  		return u.OfSearchResultLocation
 10239  	}
 10240  	return nil
 10241  }
 10242  
 10243  // Returns a pointer to the underlying variant's property, if present.
 10244  func (u BetaTextCitationParamUnion) GetEndCharIndex() *int64 {
 10245  	if vt := u.OfCharLocation; vt != nil {
 10246  		return &vt.EndCharIndex
 10247  	}
 10248  	return nil
 10249  }
 10250  
 10251  // Returns a pointer to the underlying variant's property, if present.
 10252  func (u BetaTextCitationParamUnion) GetStartCharIndex() *int64 {
 10253  	if vt := u.OfCharLocation; vt != nil {
 10254  		return &vt.StartCharIndex
 10255  	}
 10256  	return nil
 10257  }
 10258  
 10259  // Returns a pointer to the underlying variant's property, if present.
 10260  func (u BetaTextCitationParamUnion) GetEndPageNumber() *int64 {
 10261  	if vt := u.OfPageLocation; vt != nil {
 10262  		return &vt.EndPageNumber
 10263  	}
 10264  	return nil
 10265  }
 10266  
 10267  // Returns a pointer to the underlying variant's property, if present.
 10268  func (u BetaTextCitationParamUnion) GetStartPageNumber() *int64 {
 10269  	if vt := u.OfPageLocation; vt != nil {
 10270  		return &vt.StartPageNumber
 10271  	}
 10272  	return nil
 10273  }
 10274  
 10275  // Returns a pointer to the underlying variant's property, if present.
 10276  func (u BetaTextCitationParamUnion) GetEncryptedIndex() *string {
 10277  	if vt := u.OfWebSearchResultLocation; vt != nil {
 10278  		return &vt.EncryptedIndex
 10279  	}
 10280  	return nil
 10281  }
 10282  
 10283  // Returns a pointer to the underlying variant's property, if present.
 10284  func (u BetaTextCitationParamUnion) GetURL() *string {
 10285  	if vt := u.OfWebSearchResultLocation; vt != nil {
 10286  		return &vt.URL
 10287  	}
 10288  	return nil
 10289  }
 10290  
 10291  // Returns a pointer to the underlying variant's property, if present.
 10292  func (u BetaTextCitationParamUnion) GetSearchResultIndex() *int64 {
 10293  	if vt := u.OfSearchResultLocation; vt != nil {
 10294  		return &vt.SearchResultIndex
 10295  	}
 10296  	return nil
 10297  }
 10298  
 10299  // Returns a pointer to the underlying variant's property, if present.
 10300  func (u BetaTextCitationParamUnion) GetSource() *string {
 10301  	if vt := u.OfSearchResultLocation; vt != nil {
 10302  		return &vt.Source
 10303  	}
 10304  	return nil
 10305  }
 10306  
 10307  // Returns a pointer to the underlying variant's property, if present.
 10308  func (u BetaTextCitationParamUnion) GetCitedText() *string {
 10309  	if vt := u.OfCharLocation; vt != nil {
 10310  		return (*string)(&vt.CitedText)
 10311  	} else if vt := u.OfPageLocation; vt != nil {
 10312  		return (*string)(&vt.CitedText)
 10313  	} else if vt := u.OfContentBlockLocation; vt != nil {
 10314  		return (*string)(&vt.CitedText)
 10315  	} else if vt := u.OfWebSearchResultLocation; vt != nil {
 10316  		return (*string)(&vt.CitedText)
 10317  	} else if vt := u.OfSearchResultLocation; vt != nil {
 10318  		return (*string)(&vt.CitedText)
 10319  	}
 10320  	return nil
 10321  }
 10322  
 10323  // Returns a pointer to the underlying variant's property, if present.
 10324  func (u BetaTextCitationParamUnion) GetDocumentIndex() *int64 {
 10325  	if vt := u.OfCharLocation; vt != nil {
 10326  		return (*int64)(&vt.DocumentIndex)
 10327  	} else if vt := u.OfPageLocation; vt != nil {
 10328  		return (*int64)(&vt.DocumentIndex)
 10329  	} else if vt := u.OfContentBlockLocation; vt != nil {
 10330  		return (*int64)(&vt.DocumentIndex)
 10331  	}
 10332  	return nil
 10333  }
 10334  
 10335  // Returns a pointer to the underlying variant's property, if present.
 10336  func (u BetaTextCitationParamUnion) GetDocumentTitle() *string {
 10337  	if vt := u.OfCharLocation; vt != nil && vt.DocumentTitle.Valid() {
 10338  		return &vt.DocumentTitle.Value
 10339  	} else if vt := u.OfPageLocation; vt != nil && vt.DocumentTitle.Valid() {
 10340  		return &vt.DocumentTitle.Value
 10341  	} else if vt := u.OfContentBlockLocation; vt != nil && vt.DocumentTitle.Valid() {
 10342  		return &vt.DocumentTitle.Value
 10343  	}
 10344  	return nil
 10345  }
 10346  
 10347  // Returns a pointer to the underlying variant's property, if present.
 10348  func (u BetaTextCitationParamUnion) GetType() *string {
 10349  	if vt := u.OfCharLocation; vt != nil {
 10350  		return (*string)(&vt.Type)
 10351  	} else if vt := u.OfPageLocation; vt != nil {
 10352  		return (*string)(&vt.Type)
 10353  	} else if vt := u.OfContentBlockLocation; vt != nil {
 10354  		return (*string)(&vt.Type)
 10355  	} else if vt := u.OfWebSearchResultLocation; vt != nil {
 10356  		return (*string)(&vt.Type)
 10357  	} else if vt := u.OfSearchResultLocation; vt != nil {
 10358  		return (*string)(&vt.Type)
 10359  	}
 10360  	return nil
 10361  }
 10362  
 10363  // Returns a pointer to the underlying variant's property, if present.
 10364  func (u BetaTextCitationParamUnion) GetEndBlockIndex() *int64 {
 10365  	if vt := u.OfContentBlockLocation; vt != nil {
 10366  		return (*int64)(&vt.EndBlockIndex)
 10367  	} else if vt := u.OfSearchResultLocation; vt != nil {
 10368  		return (*int64)(&vt.EndBlockIndex)
 10369  	}
 10370  	return nil
 10371  }
 10372  
 10373  // Returns a pointer to the underlying variant's property, if present.
 10374  func (u BetaTextCitationParamUnion) GetStartBlockIndex() *int64 {
 10375  	if vt := u.OfContentBlockLocation; vt != nil {
 10376  		return (*int64)(&vt.StartBlockIndex)
 10377  	} else if vt := u.OfSearchResultLocation; vt != nil {
 10378  		return (*int64)(&vt.StartBlockIndex)
 10379  	}
 10380  	return nil
 10381  }
 10382  
 10383  // Returns a pointer to the underlying variant's property, if present.
 10384  func (u BetaTextCitationParamUnion) GetTitle() *string {
 10385  	if vt := u.OfWebSearchResultLocation; vt != nil && vt.Title.Valid() {
 10386  		return &vt.Title.Value
 10387  	} else if vt := u.OfSearchResultLocation; vt != nil && vt.Title.Valid() {
 10388  		return &vt.Title.Value
 10389  	}
 10390  	return nil
 10391  }
 10392  
 10393  func init() {
 10394  	apijson.RegisterUnion[BetaTextCitationParamUnion](
 10395  		"type",
 10396  		apijson.Discriminator[BetaCitationCharLocationParam]("char_location"),
 10397  		apijson.Discriminator[BetaCitationPageLocationParam]("page_location"),
 10398  		apijson.Discriminator[BetaCitationContentBlockLocationParam]("content_block_location"),
 10399  		apijson.Discriminator[BetaCitationWebSearchResultLocationParam]("web_search_result_location"),
 10400  		apijson.Discriminator[BetaCitationSearchResultLocationParam]("search_result_location"),
 10401  	)
 10402  }
 10403  
 10404  type BetaTextDelta struct {
 10405  	Text string             `json:"text" api:"required"`
 10406  	Type constant.TextDelta `json:"type" default:"text_delta"`
 10407  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 10408  	JSON struct {
 10409  		Text        respjson.Field
 10410  		Type        respjson.Field
 10411  		ExtraFields map[string]respjson.Field
 10412  		raw         string
 10413  	} `json:"-"`
 10414  }
 10415  
 10416  // Returns the unmodified JSON received from the API
 10417  func (r BetaTextDelta) RawJSON() string { return r.JSON.raw }
 10418  func (r *BetaTextDelta) UnmarshalJSON(data []byte) error {
 10419  	return apijson.UnmarshalRoot(data, r)
 10420  }
 10421  
 10422  type BetaTextEditorCodeExecutionCreateResultBlock struct {
 10423  	IsFileUpdate bool                                         `json:"is_file_update" api:"required"`
 10424  	Type         constant.TextEditorCodeExecutionCreateResult `json:"type" default:"text_editor_code_execution_create_result"`
 10425  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 10426  	JSON struct {
 10427  		IsFileUpdate respjson.Field
 10428  		Type         respjson.Field
 10429  		ExtraFields  map[string]respjson.Field
 10430  		raw          string
 10431  	} `json:"-"`
 10432  }
 10433  
 10434  // Returns the unmodified JSON received from the API
 10435  func (r BetaTextEditorCodeExecutionCreateResultBlock) RawJSON() string { return r.JSON.raw }
 10436  func (r *BetaTextEditorCodeExecutionCreateResultBlock) UnmarshalJSON(data []byte) error {
 10437  	return apijson.UnmarshalRoot(data, r)
 10438  }
 10439  
 10440  // The properties IsFileUpdate, Type are required.
 10441  type BetaTextEditorCodeExecutionCreateResultBlockParam struct {
 10442  	IsFileUpdate bool `json:"is_file_update" api:"required"`
 10443  	// This field can be elided, and will marshal its zero value as
 10444  	// "text_editor_code_execution_create_result".
 10445  	Type constant.TextEditorCodeExecutionCreateResult `json:"type" default:"text_editor_code_execution_create_result"`
 10446  	paramObj
 10447  }
 10448  
 10449  func (r BetaTextEditorCodeExecutionCreateResultBlockParam) MarshalJSON() (data []byte, err error) {
 10450  	type shadow BetaTextEditorCodeExecutionCreateResultBlockParam
 10451  	return param.MarshalObject(r, (*shadow)(&r))
 10452  }
 10453  func (r *BetaTextEditorCodeExecutionCreateResultBlockParam) UnmarshalJSON(data []byte) error {
 10454  	return apijson.UnmarshalRoot(data, r)
 10455  }
 10456  
 10457  type BetaTextEditorCodeExecutionStrReplaceResultBlock struct {
 10458  	Lines    []string                                         `json:"lines" api:"required"`
 10459  	NewLines int64                                            `json:"new_lines" api:"required"`
 10460  	NewStart int64                                            `json:"new_start" api:"required"`
 10461  	OldLines int64                                            `json:"old_lines" api:"required"`
 10462  	OldStart int64                                            `json:"old_start" api:"required"`
 10463  	Type     constant.TextEditorCodeExecutionStrReplaceResult `json:"type" default:"text_editor_code_execution_str_replace_result"`
 10464  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 10465  	JSON struct {
 10466  		Lines       respjson.Field
 10467  		NewLines    respjson.Field
 10468  		NewStart    respjson.Field
 10469  		OldLines    respjson.Field
 10470  		OldStart    respjson.Field
 10471  		Type        respjson.Field
 10472  		ExtraFields map[string]respjson.Field
 10473  		raw         string
 10474  	} `json:"-"`
 10475  }
 10476  
 10477  // Returns the unmodified JSON received from the API
 10478  func (r BetaTextEditorCodeExecutionStrReplaceResultBlock) RawJSON() string { return r.JSON.raw }
 10479  func (r *BetaTextEditorCodeExecutionStrReplaceResultBlock) UnmarshalJSON(data []byte) error {
 10480  	return apijson.UnmarshalRoot(data, r)
 10481  }
 10482  
 10483  // The property Type is required.
 10484  type BetaTextEditorCodeExecutionStrReplaceResultBlockParam struct {
 10485  	NewLines param.Opt[int64] `json:"new_lines,omitzero"`
 10486  	NewStart param.Opt[int64] `json:"new_start,omitzero"`
 10487  	OldLines param.Opt[int64] `json:"old_lines,omitzero"`
 10488  	OldStart param.Opt[int64] `json:"old_start,omitzero"`
 10489  	Lines    []string         `json:"lines,omitzero"`
 10490  	// This field can be elided, and will marshal its zero value as
 10491  	// "text_editor_code_execution_str_replace_result".
 10492  	Type constant.TextEditorCodeExecutionStrReplaceResult `json:"type" default:"text_editor_code_execution_str_replace_result"`
 10493  	paramObj
 10494  }
 10495  
 10496  func (r BetaTextEditorCodeExecutionStrReplaceResultBlockParam) MarshalJSON() (data []byte, err error) {
 10497  	type shadow BetaTextEditorCodeExecutionStrReplaceResultBlockParam
 10498  	return param.MarshalObject(r, (*shadow)(&r))
 10499  }
 10500  func (r *BetaTextEditorCodeExecutionStrReplaceResultBlockParam) UnmarshalJSON(data []byte) error {
 10501  	return apijson.UnmarshalRoot(data, r)
 10502  }
 10503  
 10504  type BetaTextEditorCodeExecutionToolResultBlock struct {
 10505  	Content   BetaTextEditorCodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
 10506  	ToolUseID string                                                 `json:"tool_use_id" api:"required"`
 10507  	Type      constant.TextEditorCodeExecutionToolResult             `json:"type" default:"text_editor_code_execution_tool_result"`
 10508  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 10509  	JSON struct {
 10510  		Content     respjson.Field
 10511  		ToolUseID   respjson.Field
 10512  		Type        respjson.Field
 10513  		ExtraFields map[string]respjson.Field
 10514  		raw         string
 10515  	} `json:"-"`
 10516  }
 10517  
 10518  // Returns the unmodified JSON received from the API
 10519  func (r BetaTextEditorCodeExecutionToolResultBlock) RawJSON() string { return r.JSON.raw }
 10520  func (r *BetaTextEditorCodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error {
 10521  	return apijson.UnmarshalRoot(data, r)
 10522  }
 10523  
 10524  // BetaTextEditorCodeExecutionToolResultBlockContentUnion contains all possible
 10525  // properties and values from [BetaTextEditorCodeExecutionToolResultError],
 10526  // [BetaTextEditorCodeExecutionViewResultBlock],
 10527  // [BetaTextEditorCodeExecutionCreateResultBlock],
 10528  // [BetaTextEditorCodeExecutionStrReplaceResultBlock].
 10529  //
 10530  // Use the methods beginning with 'As' to cast the union to one of its variants.
 10531  type BetaTextEditorCodeExecutionToolResultBlockContentUnion struct {
 10532  	// This field is from variant [BetaTextEditorCodeExecutionToolResultError].
 10533  	ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode `json:"error_code"`
 10534  	// This field is from variant [BetaTextEditorCodeExecutionToolResultError].
 10535  	ErrorMessage string `json:"error_message"`
 10536  	Type         string `json:"type"`
 10537  	// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
 10538  	Content string `json:"content"`
 10539  	// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
 10540  	FileType BetaTextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
 10541  	// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
 10542  	NumLines int64 `json:"num_lines"`
 10543  	// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
 10544  	StartLine int64 `json:"start_line"`
 10545  	// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
 10546  	TotalLines int64 `json:"total_lines"`
 10547  	// This field is from variant [BetaTextEditorCodeExecutionCreateResultBlock].
 10548  	IsFileUpdate bool `json:"is_file_update"`
 10549  	// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
 10550  	Lines []string `json:"lines"`
 10551  	// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
 10552  	NewLines int64 `json:"new_lines"`
 10553  	// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
 10554  	NewStart int64 `json:"new_start"`
 10555  	// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
 10556  	OldLines int64 `json:"old_lines"`
 10557  	// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
 10558  	OldStart int64 `json:"old_start"`
 10559  	JSON     struct {
 10560  		ErrorCode    respjson.Field
 10561  		ErrorMessage respjson.Field
 10562  		Type         respjson.Field
 10563  		Content      respjson.Field
 10564  		FileType     respjson.Field
 10565  		NumLines     respjson.Field
 10566  		StartLine    respjson.Field
 10567  		TotalLines   respjson.Field
 10568  		IsFileUpdate respjson.Field
 10569  		Lines        respjson.Field
 10570  		NewLines     respjson.Field
 10571  		NewStart     respjson.Field
 10572  		OldLines     respjson.Field
 10573  		OldStart     respjson.Field
 10574  		raw          string
 10575  	} `json:"-"`
 10576  }
 10577  
 10578  func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionToolResultError() (v BetaTextEditorCodeExecutionToolResultError) {
 10579  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10580  	return
 10581  }
 10582  
 10583  func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionViewResultBlock() (v BetaTextEditorCodeExecutionViewResultBlock) {
 10584  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10585  	return
 10586  }
 10587  
 10588  func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionCreateResultBlock() (v BetaTextEditorCodeExecutionCreateResultBlock) {
 10589  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10590  	return
 10591  }
 10592  
 10593  func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionStrReplaceResultBlock() (v BetaTextEditorCodeExecutionStrReplaceResultBlock) {
 10594  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 10595  	return
 10596  }
 10597  
 10598  // Returns the unmodified JSON received from the API
 10599  func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) RawJSON() string { return u.JSON.raw }
 10600  
 10601  func (r *BetaTextEditorCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error {
 10602  	return apijson.UnmarshalRoot(data, r)
 10603  }
 10604  
 10605  // The properties Content, ToolUseID, Type are required.
 10606  type BetaTextEditorCodeExecutionToolResultBlockParam struct {
 10607  	Content   BetaTextEditorCodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
 10608  	ToolUseID string                                                      `json:"tool_use_id" api:"required"`
 10609  	// Create a cache control breakpoint at this content block.
 10610  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 10611  	// This field can be elided, and will marshal its zero value as
 10612  	// "text_editor_code_execution_tool_result".
 10613  	Type constant.TextEditorCodeExecutionToolResult `json:"type" default:"text_editor_code_execution_tool_result"`
 10614  	paramObj
 10615  }
 10616  
 10617  func (r BetaTextEditorCodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error) {
 10618  	type shadow BetaTextEditorCodeExecutionToolResultBlockParam
 10619  	return param.MarshalObject(r, (*shadow)(&r))
 10620  }
 10621  func (r *BetaTextEditorCodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error {
 10622  	return apijson.UnmarshalRoot(data, r)
 10623  }
 10624  
 10625  // Only one field can be non-zero.
 10626  //
 10627  // Use [param.IsOmitted] to confirm if a field is set.
 10628  type BetaTextEditorCodeExecutionToolResultBlockParamContentUnion struct {
 10629  	OfRequestTextEditorCodeExecutionToolResultError       *BetaTextEditorCodeExecutionToolResultErrorParam       `json:",omitzero,inline"`
 10630  	OfRequestTextEditorCodeExecutionViewResultBlock       *BetaTextEditorCodeExecutionViewResultBlockParam       `json:",omitzero,inline"`
 10631  	OfRequestTextEditorCodeExecutionCreateResultBlock     *BetaTextEditorCodeExecutionCreateResultBlockParam     `json:",omitzero,inline"`
 10632  	OfRequestTextEditorCodeExecutionStrReplaceResultBlock *BetaTextEditorCodeExecutionStrReplaceResultBlockParam `json:",omitzero,inline"`
 10633  	paramUnion
 10634  }
 10635  
 10636  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
 10637  	return param.MarshalUnion(u, u.OfRequestTextEditorCodeExecutionToolResultError, u.OfRequestTextEditorCodeExecutionViewResultBlock, u.OfRequestTextEditorCodeExecutionCreateResultBlock, u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock)
 10638  }
 10639  func (u *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
 10640  	return apijson.UnmarshalRoot(data, u)
 10641  }
 10642  
 10643  func (u *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) asAny() any {
 10644  	if !param.IsOmitted(u.OfRequestTextEditorCodeExecutionToolResultError) {
 10645  		return u.OfRequestTextEditorCodeExecutionToolResultError
 10646  	} else if !param.IsOmitted(u.OfRequestTextEditorCodeExecutionViewResultBlock) {
 10647  		return u.OfRequestTextEditorCodeExecutionViewResultBlock
 10648  	} else if !param.IsOmitted(u.OfRequestTextEditorCodeExecutionCreateResultBlock) {
 10649  		return u.OfRequestTextEditorCodeExecutionCreateResultBlock
 10650  	} else if !param.IsOmitted(u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock) {
 10651  		return u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock
 10652  	}
 10653  	return nil
 10654  }
 10655  
 10656  // Returns a pointer to the underlying variant's property, if present.
 10657  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string {
 10658  	if vt := u.OfRequestTextEditorCodeExecutionToolResultError; vt != nil {
 10659  		return (*string)(&vt.ErrorCode)
 10660  	}
 10661  	return nil
 10662  }
 10663  
 10664  // Returns a pointer to the underlying variant's property, if present.
 10665  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorMessage() *string {
 10666  	if vt := u.OfRequestTextEditorCodeExecutionToolResultError; vt != nil && vt.ErrorMessage.Valid() {
 10667  		return &vt.ErrorMessage.Value
 10668  	}
 10669  	return nil
 10670  }
 10671  
 10672  // Returns a pointer to the underlying variant's property, if present.
 10673  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetContent() *string {
 10674  	if vt := u.OfRequestTextEditorCodeExecutionViewResultBlock; vt != nil {
 10675  		return &vt.Content
 10676  	}
 10677  	return nil
 10678  }
 10679  
 10680  // Returns a pointer to the underlying variant's property, if present.
 10681  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetFileType() *string {
 10682  	if vt := u.OfRequestTextEditorCodeExecutionViewResultBlock; vt != nil {
 10683  		return (*string)(&vt.FileType)
 10684  	}
 10685  	return nil
 10686  }
 10687  
 10688  // Returns a pointer to the underlying variant's property, if present.
 10689  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNumLines() *int64 {
 10690  	if vt := u.OfRequestTextEditorCodeExecutionViewResultBlock; vt != nil && vt.NumLines.Valid() {
 10691  		return &vt.NumLines.Value
 10692  	}
 10693  	return nil
 10694  }
 10695  
 10696  // Returns a pointer to the underlying variant's property, if present.
 10697  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetStartLine() *int64 {
 10698  	if vt := u.OfRequestTextEditorCodeExecutionViewResultBlock; vt != nil && vt.StartLine.Valid() {
 10699  		return &vt.StartLine.Value
 10700  	}
 10701  	return nil
 10702  }
 10703  
 10704  // Returns a pointer to the underlying variant's property, if present.
 10705  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetTotalLines() *int64 {
 10706  	if vt := u.OfRequestTextEditorCodeExecutionViewResultBlock; vt != nil && vt.TotalLines.Valid() {
 10707  		return &vt.TotalLines.Value
 10708  	}
 10709  	return nil
 10710  }
 10711  
 10712  // Returns a pointer to the underlying variant's property, if present.
 10713  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetIsFileUpdate() *bool {
 10714  	if vt := u.OfRequestTextEditorCodeExecutionCreateResultBlock; vt != nil {
 10715  		return &vt.IsFileUpdate
 10716  	}
 10717  	return nil
 10718  }
 10719  
 10720  // Returns a pointer to the underlying variant's property, if present.
 10721  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetLines() []string {
 10722  	if vt := u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock; vt != nil {
 10723  		return vt.Lines
 10724  	}
 10725  	return nil
 10726  }
 10727  
 10728  // Returns a pointer to the underlying variant's property, if present.
 10729  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewLines() *int64 {
 10730  	if vt := u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock; vt != nil && vt.NewLines.Valid() {
 10731  		return &vt.NewLines.Value
 10732  	}
 10733  	return nil
 10734  }
 10735  
 10736  // Returns a pointer to the underlying variant's property, if present.
 10737  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewStart() *int64 {
 10738  	if vt := u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock; vt != nil && vt.NewStart.Valid() {
 10739  		return &vt.NewStart.Value
 10740  	}
 10741  	return nil
 10742  }
 10743  
 10744  // Returns a pointer to the underlying variant's property, if present.
 10745  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldLines() *int64 {
 10746  	if vt := u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock; vt != nil && vt.OldLines.Valid() {
 10747  		return &vt.OldLines.Value
 10748  	}
 10749  	return nil
 10750  }
 10751  
 10752  // Returns a pointer to the underlying variant's property, if present.
 10753  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldStart() *int64 {
 10754  	if vt := u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock; vt != nil && vt.OldStart.Valid() {
 10755  		return &vt.OldStart.Value
 10756  	}
 10757  	return nil
 10758  }
 10759  
 10760  // Returns a pointer to the underlying variant's property, if present.
 10761  func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetType() *string {
 10762  	if vt := u.OfRequestTextEditorCodeExecutionToolResultError; vt != nil {
 10763  		return (*string)(&vt.Type)
 10764  	} else if vt := u.OfRequestTextEditorCodeExecutionViewResultBlock; vt != nil {
 10765  		return (*string)(&vt.Type)
 10766  	} else if vt := u.OfRequestTextEditorCodeExecutionCreateResultBlock; vt != nil {
 10767  		return (*string)(&vt.Type)
 10768  	} else if vt := u.OfRequestTextEditorCodeExecutionStrReplaceResultBlock; vt != nil {
 10769  		return (*string)(&vt.Type)
 10770  	}
 10771  	return nil
 10772  }
 10773  
 10774  type BetaTextEditorCodeExecutionToolResultError struct {
 10775  	// Any of "invalid_tool_input", "unavailable", "too_many_requests",
 10776  	// "execution_time_exceeded", "file_not_found".
 10777  	ErrorCode    BetaTextEditorCodeExecutionToolResultErrorErrorCode `json:"error_code" api:"required"`
 10778  	ErrorMessage string                                              `json:"error_message" api:"required"`
 10779  	Type         constant.TextEditorCodeExecutionToolResultError     `json:"type" default:"text_editor_code_execution_tool_result_error"`
 10780  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 10781  	JSON struct {
 10782  		ErrorCode    respjson.Field
 10783  		ErrorMessage respjson.Field
 10784  		Type         respjson.Field
 10785  		ExtraFields  map[string]respjson.Field
 10786  		raw          string
 10787  	} `json:"-"`
 10788  }
 10789  
 10790  // Returns the unmodified JSON received from the API
 10791  func (r BetaTextEditorCodeExecutionToolResultError) RawJSON() string { return r.JSON.raw }
 10792  func (r *BetaTextEditorCodeExecutionToolResultError) UnmarshalJSON(data []byte) error {
 10793  	return apijson.UnmarshalRoot(data, r)
 10794  }
 10795  
 10796  type BetaTextEditorCodeExecutionToolResultErrorErrorCode string
 10797  
 10798  const (
 10799  	BetaTextEditorCodeExecutionToolResultErrorErrorCodeInvalidToolInput      BetaTextEditorCodeExecutionToolResultErrorErrorCode = "invalid_tool_input"
 10800  	BetaTextEditorCodeExecutionToolResultErrorErrorCodeUnavailable           BetaTextEditorCodeExecutionToolResultErrorErrorCode = "unavailable"
 10801  	BetaTextEditorCodeExecutionToolResultErrorErrorCodeTooManyRequests       BetaTextEditorCodeExecutionToolResultErrorErrorCode = "too_many_requests"
 10802  	BetaTextEditorCodeExecutionToolResultErrorErrorCodeExecutionTimeExceeded BetaTextEditorCodeExecutionToolResultErrorErrorCode = "execution_time_exceeded"
 10803  	BetaTextEditorCodeExecutionToolResultErrorErrorCodeFileNotFound          BetaTextEditorCodeExecutionToolResultErrorErrorCode = "file_not_found"
 10804  )
 10805  
 10806  // The properties ErrorCode, Type are required.
 10807  type BetaTextEditorCodeExecutionToolResultErrorParam struct {
 10808  	// Any of "invalid_tool_input", "unavailable", "too_many_requests",
 10809  	// "execution_time_exceeded", "file_not_found".
 10810  	ErrorCode    BetaTextEditorCodeExecutionToolResultErrorParamErrorCode `json:"error_code,omitzero" api:"required"`
 10811  	ErrorMessage param.Opt[string]                                        `json:"error_message,omitzero"`
 10812  	// This field can be elided, and will marshal its zero value as
 10813  	// "text_editor_code_execution_tool_result_error".
 10814  	Type constant.TextEditorCodeExecutionToolResultError `json:"type" default:"text_editor_code_execution_tool_result_error"`
 10815  	paramObj
 10816  }
 10817  
 10818  func (r BetaTextEditorCodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error) {
 10819  	type shadow BetaTextEditorCodeExecutionToolResultErrorParam
 10820  	return param.MarshalObject(r, (*shadow)(&r))
 10821  }
 10822  func (r *BetaTextEditorCodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error {
 10823  	return apijson.UnmarshalRoot(data, r)
 10824  }
 10825  
 10826  type BetaTextEditorCodeExecutionToolResultErrorParamErrorCode string
 10827  
 10828  const (
 10829  	BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeInvalidToolInput      BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "invalid_tool_input"
 10830  	BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeUnavailable           BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "unavailable"
 10831  	BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeTooManyRequests       BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "too_many_requests"
 10832  	BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeExecutionTimeExceeded BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "execution_time_exceeded"
 10833  	BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeFileNotFound          BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "file_not_found"
 10834  )
 10835  
 10836  type BetaTextEditorCodeExecutionViewResultBlock struct {
 10837  	Content string `json:"content" api:"required"`
 10838  	// Any of "text", "image", "pdf".
 10839  	FileType   BetaTextEditorCodeExecutionViewResultBlockFileType `json:"file_type" api:"required"`
 10840  	NumLines   int64                                              `json:"num_lines" api:"required"`
 10841  	StartLine  int64                                              `json:"start_line" api:"required"`
 10842  	TotalLines int64                                              `json:"total_lines" api:"required"`
 10843  	Type       constant.TextEditorCodeExecutionViewResult         `json:"type" default:"text_editor_code_execution_view_result"`
 10844  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 10845  	JSON struct {
 10846  		Content     respjson.Field
 10847  		FileType    respjson.Field
 10848  		NumLines    respjson.Field
 10849  		StartLine   respjson.Field
 10850  		TotalLines  respjson.Field
 10851  		Type        respjson.Field
 10852  		ExtraFields map[string]respjson.Field
 10853  		raw         string
 10854  	} `json:"-"`
 10855  }
 10856  
 10857  // Returns the unmodified JSON received from the API
 10858  func (r BetaTextEditorCodeExecutionViewResultBlock) RawJSON() string { return r.JSON.raw }
 10859  func (r *BetaTextEditorCodeExecutionViewResultBlock) UnmarshalJSON(data []byte) error {
 10860  	return apijson.UnmarshalRoot(data, r)
 10861  }
 10862  
 10863  type BetaTextEditorCodeExecutionViewResultBlockFileType string
 10864  
 10865  const (
 10866  	BetaTextEditorCodeExecutionViewResultBlockFileTypeText  BetaTextEditorCodeExecutionViewResultBlockFileType = "text"
 10867  	BetaTextEditorCodeExecutionViewResultBlockFileTypeImage BetaTextEditorCodeExecutionViewResultBlockFileType = "image"
 10868  	BetaTextEditorCodeExecutionViewResultBlockFileTypePDF   BetaTextEditorCodeExecutionViewResultBlockFileType = "pdf"
 10869  )
 10870  
 10871  // The properties Content, FileType, Type are required.
 10872  type BetaTextEditorCodeExecutionViewResultBlockParam struct {
 10873  	Content string `json:"content" api:"required"`
 10874  	// Any of "text", "image", "pdf".
 10875  	FileType   BetaTextEditorCodeExecutionViewResultBlockParamFileType `json:"file_type,omitzero" api:"required"`
 10876  	NumLines   param.Opt[int64]                                        `json:"num_lines,omitzero"`
 10877  	StartLine  param.Opt[int64]                                        `json:"start_line,omitzero"`
 10878  	TotalLines param.Opt[int64]                                        `json:"total_lines,omitzero"`
 10879  	// This field can be elided, and will marshal its zero value as
 10880  	// "text_editor_code_execution_view_result".
 10881  	Type constant.TextEditorCodeExecutionViewResult `json:"type" default:"text_editor_code_execution_view_result"`
 10882  	paramObj
 10883  }
 10884  
 10885  func (r BetaTextEditorCodeExecutionViewResultBlockParam) MarshalJSON() (data []byte, err error) {
 10886  	type shadow BetaTextEditorCodeExecutionViewResultBlockParam
 10887  	return param.MarshalObject(r, (*shadow)(&r))
 10888  }
 10889  func (r *BetaTextEditorCodeExecutionViewResultBlockParam) UnmarshalJSON(data []byte) error {
 10890  	return apijson.UnmarshalRoot(data, r)
 10891  }
 10892  
 10893  type BetaTextEditorCodeExecutionViewResultBlockParamFileType string
 10894  
 10895  const (
 10896  	BetaTextEditorCodeExecutionViewResultBlockParamFileTypeText  BetaTextEditorCodeExecutionViewResultBlockParamFileType = "text"
 10897  	BetaTextEditorCodeExecutionViewResultBlockParamFileTypeImage BetaTextEditorCodeExecutionViewResultBlockParamFileType = "image"
 10898  	BetaTextEditorCodeExecutionViewResultBlockParamFileTypePDF   BetaTextEditorCodeExecutionViewResultBlockParamFileType = "pdf"
 10899  )
 10900  
 10901  type BetaThinkingBlock struct {
 10902  	// A value used to verify that this thinking block was generated by Claude when it
 10903  	// is passed back to the API.
 10904  	//
 10905  	// This is an opaque field and should not be interpreted or parsed. When passing
 10906  	// thinking blocks back to the API (required when using tools with extended
 10907  	// thinking), pass them back exactly as received, with this field intact.
 10908  	//
 10909  	// See
 10910  	// [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
 10911  	// for details.
 10912  	Signature string `json:"signature" api:"required"`
 10913  	// The text of Claude's thinking process for this block.
 10914  	Thinking string            `json:"thinking" api:"required"`
 10915  	Type     constant.Thinking `json:"type" default:"thinking"`
 10916  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 10917  	JSON struct {
 10918  		Signature   respjson.Field
 10919  		Thinking    respjson.Field
 10920  		Type        respjson.Field
 10921  		ExtraFields map[string]respjson.Field
 10922  		raw         string
 10923  	} `json:"-"`
 10924  }
 10925  
 10926  // Returns the unmodified JSON received from the API
 10927  func (r BetaThinkingBlock) RawJSON() string { return r.JSON.raw }
 10928  func (r *BetaThinkingBlock) UnmarshalJSON(data []byte) error {
 10929  	return apijson.UnmarshalRoot(data, r)
 10930  }
 10931  
 10932  // Controls for block binding: what happens when a thinking block this request
 10933  // sends back fails the conversation check. Every field is optional; an empty
 10934  // object means every default.
 10935  type BetaThinkingBlockBindingParam struct {
 10936  	// What happens when a thinking block in `messages` fails the conversation check:
 10937  	// it was created in a different conversation, or the messages before it have
 10938  	// changed since. `"error"` (the default) fails the request with a 400 error.
 10939  	// `"drop_block"` removes the failing blocks and the request proceeds; the model no
 10940  	// longer sees the dropped reasoning.
 10941  	//
 10942  	// Any of "error", "drop_block".
 10943  	PrefixMismatchBehavior BetaThinkingPrefixMismatchBehavior `json:"prefix_mismatch_behavior,omitzero"`
 10944  	paramObj
 10945  }
 10946  
 10947  func (r BetaThinkingBlockBindingParam) MarshalJSON() (data []byte, err error) {
 10948  	type shadow BetaThinkingBlockBindingParam
 10949  	return param.MarshalObject(r, (*shadow)(&r))
 10950  }
 10951  func (r *BetaThinkingBlockBindingParam) UnmarshalJSON(data []byte) error {
 10952  	return apijson.UnmarshalRoot(data, r)
 10953  }
 10954  
 10955  // The properties Signature, Thinking, Type are required.
 10956  type BetaThinkingBlockParam struct {
 10957  	// The `signature` value of this thinking block, exactly as returned by the API in
 10958  	// a previous response. Used to verify that the block was generated by Claude.
 10959  	//
 10960  	// Thinking blocks must be passed back unmodified and in their original order; a
 10961  	// modified block results in a 400 `invalid_request_error`.
 10962  	Signature string `json:"signature" api:"required"`
 10963  	// The `thinking` text of this block as returned by the API.
 10964  	Thinking string `json:"thinking" api:"required"`
 10965  	// This field can be elided, and will marshal its zero value as "thinking".
 10966  	Type constant.Thinking `json:"type" default:"thinking"`
 10967  	paramObj
 10968  }
 10969  
 10970  func (r BetaThinkingBlockParam) MarshalJSON() (data []byte, err error) {
 10971  	type shadow BetaThinkingBlockParam
 10972  	return param.MarshalObject(r, (*shadow)(&r))
 10973  }
 10974  func (r *BetaThinkingBlockParam) UnmarshalJSON(data []byte) error {
 10975  	return apijson.UnmarshalRoot(data, r)
 10976  }
 10977  
 10978  // The property Type is required.
 10979  type BetaThinkingConfigAdaptiveParam struct {
 10980  	// Controls how thinking content appears in the response. When set to `summarized`,
 10981  	// thinking is returned normally. When set to `omitted`, thinking content is
 10982  	// redacted but a signature is returned for multi-turn continuity. Defaults to
 10983  	// `summarized`.
 10984  	//
 10985  	// Any of "summarized", "omitted", "updates".
 10986  	Display BetaThinkingConfigAdaptiveDisplay `json:"display,omitzero"`
 10987  	// Controls for block binding: what happens when a thinking block this request
 10988  	// sends back fails the conversation check. Every field is optional; an empty
 10989  	// object means every default.
 10990  	BlockBinding BetaThinkingBlockBindingParam `json:"block_binding,omitzero"`
 10991  	// This field can be elided, and will marshal its zero value as "adaptive".
 10992  	Type constant.Adaptive `json:"type" default:"adaptive"`
 10993  	paramObj
 10994  }
 10995  
 10996  func (r BetaThinkingConfigAdaptiveParam) MarshalJSON() (data []byte, err error) {
 10997  	type shadow BetaThinkingConfigAdaptiveParam
 10998  	return param.MarshalObject(r, (*shadow)(&r))
 10999  }
 11000  func (r *BetaThinkingConfigAdaptiveParam) UnmarshalJSON(data []byte) error {
 11001  	return apijson.UnmarshalRoot(data, r)
 11002  }
 11003  
 11004  // Controls how thinking content appears in the response. When set to `summarized`,
 11005  // thinking is returned normally. When set to `omitted`, thinking content is
 11006  // redacted but a signature is returned for multi-turn continuity. Defaults to
 11007  // `summarized`.
 11008  type BetaThinkingConfigAdaptiveDisplay string
 11009  
 11010  const (
 11011  	BetaThinkingConfigAdaptiveDisplaySummarized BetaThinkingConfigAdaptiveDisplay = "summarized"
 11012  	BetaThinkingConfigAdaptiveDisplayOmitted    BetaThinkingConfigAdaptiveDisplay = "omitted"
 11013  	BetaThinkingConfigAdaptiveDisplayUpdates    BetaThinkingConfigAdaptiveDisplay = "updates"
 11014  )
 11015  
 11016  func NewBetaThinkingConfigDisabledParam() BetaThinkingConfigDisabledParam {
 11017  	return BetaThinkingConfigDisabledParam{
 11018  		Type: "disabled",
 11019  	}
 11020  }
 11021  
 11022  // This struct has a constant value, construct it with
 11023  // [NewBetaThinkingConfigDisabledParam].
 11024  type BetaThinkingConfigDisabledParam struct {
 11025  	Type constant.Disabled `json:"type" default:"disabled"`
 11026  	paramObj
 11027  }
 11028  
 11029  func (r BetaThinkingConfigDisabledParam) MarshalJSON() (data []byte, err error) {
 11030  	type shadow BetaThinkingConfigDisabledParam
 11031  	return param.MarshalObject(r, (*shadow)(&r))
 11032  }
 11033  func (r *BetaThinkingConfigDisabledParam) UnmarshalJSON(data []byte) error {
 11034  	return apijson.UnmarshalRoot(data, r)
 11035  }
 11036  
 11037  // The properties BudgetTokens, Type are required.
 11038  type BetaThinkingConfigEnabledParam struct {
 11039  	// Determines how many tokens Claude can use for its internal reasoning process.
 11040  	// Larger budgets can enable more thorough analysis for complex problems, improving
 11041  	// response quality.
 11042  	//
 11043  	// Must be ≥1024 and less than `max_tokens`.
 11044  	//
 11045  	// See
 11046  	// [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
 11047  	// for details.
 11048  	BudgetTokens int64 `json:"budget_tokens" api:"required"`
 11049  	// Controls how thinking content appears in the response. When set to `summarized`,
 11050  	// thinking is returned normally. When set to `omitted`, thinking content is
 11051  	// redacted but a signature is returned for multi-turn continuity. Defaults to
 11052  	// `summarized`.
 11053  	//
 11054  	// Any of "summarized", "omitted", "updates".
 11055  	Display BetaThinkingConfigEnabledDisplay `json:"display,omitzero"`
 11056  	// Controls for block binding: what happens when a thinking block this request
 11057  	// sends back fails the conversation check. Every field is optional; an empty
 11058  	// object means every default.
 11059  	BlockBinding BetaThinkingBlockBindingParam `json:"block_binding,omitzero"`
 11060  	// This field can be elided, and will marshal its zero value as "enabled".
 11061  	Type constant.Enabled `json:"type" default:"enabled"`
 11062  	paramObj
 11063  }
 11064  
 11065  func (r BetaThinkingConfigEnabledParam) MarshalJSON() (data []byte, err error) {
 11066  	type shadow BetaThinkingConfigEnabledParam
 11067  	return param.MarshalObject(r, (*shadow)(&r))
 11068  }
 11069  func (r *BetaThinkingConfigEnabledParam) UnmarshalJSON(data []byte) error {
 11070  	return apijson.UnmarshalRoot(data, r)
 11071  }
 11072  
 11073  // Controls how thinking content appears in the response. When set to `summarized`,
 11074  // thinking is returned normally. When set to `omitted`, thinking content is
 11075  // redacted but a signature is returned for multi-turn continuity. Defaults to
 11076  // `summarized`.
 11077  type BetaThinkingConfigEnabledDisplay string
 11078  
 11079  const (
 11080  	BetaThinkingConfigEnabledDisplaySummarized BetaThinkingConfigEnabledDisplay = "summarized"
 11081  	BetaThinkingConfigEnabledDisplayOmitted    BetaThinkingConfigEnabledDisplay = "omitted"
 11082  	BetaThinkingConfigEnabledDisplayUpdates    BetaThinkingConfigEnabledDisplay = "updates"
 11083  )
 11084  
 11085  func BetaThinkingConfigParamOfEnabled(budgetTokens int64) BetaThinkingConfigParamUnion {
 11086  	var enabled BetaThinkingConfigEnabledParam
 11087  	enabled.BudgetTokens = budgetTokens
 11088  	return BetaThinkingConfigParamUnion{OfEnabled: &enabled}
 11089  }
 11090  
 11091  // Only one field can be non-zero.
 11092  //
 11093  // Use [param.IsOmitted] to confirm if a field is set.
 11094  type BetaThinkingConfigParamUnion struct {
 11095  	OfEnabled  *BetaThinkingConfigEnabledParam  `json:",omitzero,inline"`
 11096  	OfDisabled *BetaThinkingConfigDisabledParam `json:",omitzero,inline"`
 11097  	OfAdaptive *BetaThinkingConfigAdaptiveParam `json:",omitzero,inline"`
 11098  	paramUnion
 11099  }
 11100  
 11101  func (u BetaThinkingConfigParamUnion) MarshalJSON() ([]byte, error) {
 11102  	return param.MarshalUnion(u, u.OfEnabled, u.OfDisabled, u.OfAdaptive)
 11103  }
 11104  func (u *BetaThinkingConfigParamUnion) UnmarshalJSON(data []byte) error {
 11105  	return apijson.UnmarshalRoot(data, u)
 11106  }
 11107  
 11108  func (u *BetaThinkingConfigParamUnion) asAny() any {
 11109  	if !param.IsOmitted(u.OfEnabled) {
 11110  		return u.OfEnabled
 11111  	} else if !param.IsOmitted(u.OfDisabled) {
 11112  		return u.OfDisabled
 11113  	} else if !param.IsOmitted(u.OfAdaptive) {
 11114  		return u.OfAdaptive
 11115  	}
 11116  	return nil
 11117  }
 11118  
 11119  // Returns a pointer to the underlying variant's property, if present.
 11120  func (u BetaThinkingConfigParamUnion) GetBudgetTokens() *int64 {
 11121  	if vt := u.OfEnabled; vt != nil {
 11122  		return &vt.BudgetTokens
 11123  	}
 11124  	return nil
 11125  }
 11126  
 11127  // Returns a pointer to the underlying variant's property, if present.
 11128  func (u BetaThinkingConfigParamUnion) GetType() *string {
 11129  	if vt := u.OfEnabled; vt != nil {
 11130  		return (*string)(&vt.Type)
 11131  	} else if vt := u.OfDisabled; vt != nil {
 11132  		return (*string)(&vt.Type)
 11133  	} else if vt := u.OfAdaptive; vt != nil {
 11134  		return (*string)(&vt.Type)
 11135  	}
 11136  	return nil
 11137  }
 11138  
 11139  // Returns a pointer to the underlying variant's property, if present.
 11140  func (u BetaThinkingConfigParamUnion) GetDisplay() *string {
 11141  	if vt := u.OfEnabled; vt != nil {
 11142  		return (*string)(&vt.Display)
 11143  	} else if vt := u.OfAdaptive; vt != nil {
 11144  		return (*string)(&vt.Display)
 11145  	}
 11146  	return nil
 11147  }
 11148  
 11149  // Returns a pointer to the underlying variant's BlockBinding property, if present.
 11150  func (u BetaThinkingConfigParamUnion) GetBlockBinding() *BetaThinkingBlockBindingParam {
 11151  	if vt := u.OfEnabled; vt != nil {
 11152  		return &vt.BlockBinding
 11153  	} else if vt := u.OfAdaptive; vt != nil {
 11154  		return &vt.BlockBinding
 11155  	}
 11156  	return nil
 11157  }
 11158  
 11159  func init() {
 11160  	apijson.RegisterUnion[BetaThinkingConfigParamUnion](
 11161  		"type",
 11162  		apijson.Discriminator[BetaThinkingConfigEnabledParam]("enabled"),
 11163  		apijson.Discriminator[BetaThinkingConfigDisabledParam]("disabled"),
 11164  		apijson.Discriminator[BetaThinkingConfigAdaptiveParam]("adaptive"),
 11165  	)
 11166  }
 11167  
 11168  type BetaThinkingDelta struct {
 11169  	// Per-frame increment of a coarse, running estimate of the tokens this thinking
 11170  	// block has produced so far. Present whenever the
 11171  	// `thinking-token-count-2026-05-13` beta is set; `null` unless `thinking.display`
 11172  	// resolves to `"omitted"` and a count is due this frame. Sum the increments across
 11173  	// `thinking_delta` frames on this block for a progress indicator. Each increment
 11174  	// is a non-negative multiple of a fixed quantum and the cadence is rate-limited,
 11175  	// so this is a deliberately lossy display hint, not a billable count;
 11176  	// `usage.output_tokens` remains authoritative.
 11177  	EstimatedTokens int64 `json:"estimated_tokens" api:"required"`
 11178  	// The incremental `thinking` text for this content block. Concatenate the
 11179  	// `thinking` values of successive `thinking_delta` events to assemble the block's
 11180  	// full `thinking` value.
 11181  	Thinking string                 `json:"thinking" api:"required"`
 11182  	Type     constant.ThinkingDelta `json:"type" default:"thinking_delta"`
 11183  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 11184  	JSON struct {
 11185  		EstimatedTokens respjson.Field
 11186  		Thinking        respjson.Field
 11187  		Type            respjson.Field
 11188  		ExtraFields     map[string]respjson.Field
 11189  		raw             string
 11190  	} `json:"-"`
 11191  }
 11192  
 11193  // Returns the unmodified JSON received from the API
 11194  func (r BetaThinkingDelta) RawJSON() string { return r.JSON.raw }
 11195  func (r *BetaThinkingDelta) UnmarshalJSON(data []byte) error {
 11196  	return apijson.UnmarshalRoot(data, r)
 11197  }
 11198  
 11199  type BetaThinkingDroppedInputTransformation struct {
 11200  	// Where the removed block was in your request, as `messages.{i}.content.{j}`: `i`
 11201  	// indexes the `messages` array you sent and `j` that message's `content` array —
 11202  	// the same form error messages use.
 11203  	Path string `json:"path" api:"required"`
 11204  	// Which binding check removed the block: `model_binding_mismatch` — it was created
 11205  	// by a model whose reasoning the requested model may not read;
 11206  	// `prefix_binding_mismatch` — the conversation before it differs from the
 11207  	// conversation it was created in (the rest of that turn's consecutive thinking
 11208  	// blocks are removed with it, each with this reason);
 11209  	// `organization_binding_mismatch` — it was created under a different organization
 11210  	// (an Anthropic organization, AWS account or Google Cloud project) and this
 11211  	// organization is not one of its additional organizations;
 11212  	// `end_user_binding_mismatch` — it was created for a different end user, or was
 11213  	// removed by the consumer-organization binding. A block that would fail several
 11214  	// checks reports one reason, in this order of precedence:
 11215  	// `organization_binding_mismatch`, `end_user_binding_mismatch`,
 11216  	// `model_binding_mismatch`, `prefix_binding_mismatch`.
 11217  	//
 11218  	// Any of "model_binding_mismatch", "prefix_binding_mismatch",
 11219  	// "organization_binding_mismatch", "end_user_binding_mismatch".
 11220  	Reason BetaThinkingDroppedInputTransformationReason `json:"reason" api:"required"`
 11221  	// Always `thinking_dropped` for this entry type.
 11222  	Type constant.ThinkingDropped `json:"type" default:"thinking_dropped"`
 11223  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 11224  	JSON struct {
 11225  		Path        respjson.Field
 11226  		Reason      respjson.Field
 11227  		Type        respjson.Field
 11228  		ExtraFields map[string]respjson.Field
 11229  		raw         string
 11230  	} `json:"-"`
 11231  }
 11232  
 11233  // Returns the unmodified JSON received from the API
 11234  func (r BetaThinkingDroppedInputTransformation) RawJSON() string { return r.JSON.raw }
 11235  func (r *BetaThinkingDroppedInputTransformation) UnmarshalJSON(data []byte) error {
 11236  	return apijson.UnmarshalRoot(data, r)
 11237  }
 11238  
 11239  // Which binding check removed the block: `model_binding_mismatch` — it was created
 11240  // by a model whose reasoning the requested model may not read;
 11241  // `prefix_binding_mismatch` — the conversation before it differs from the
 11242  // conversation it was created in (the rest of that turn's consecutive thinking
 11243  // blocks are removed with it, each with this reason);
 11244  // `organization_binding_mismatch` — it was created under a different organization
 11245  // (an Anthropic organization, AWS account or Google Cloud project) and this
 11246  // organization is not one of its additional organizations;
 11247  // `end_user_binding_mismatch` — it was created for a different end user, or was
 11248  // removed by the consumer-organization binding. A block that would fail several
 11249  // checks reports one reason, in this order of precedence:
 11250  // `organization_binding_mismatch`, `end_user_binding_mismatch`,
 11251  // `model_binding_mismatch`, `prefix_binding_mismatch`.
 11252  type BetaThinkingDroppedInputTransformationReason string
 11253  
 11254  const (
 11255  	BetaThinkingDroppedInputTransformationReasonModelBindingMismatch        BetaThinkingDroppedInputTransformationReason = "model_binding_mismatch"
 11256  	BetaThinkingDroppedInputTransformationReasonPrefixBindingMismatch       BetaThinkingDroppedInputTransformationReason = "prefix_binding_mismatch"
 11257  	BetaThinkingDroppedInputTransformationReasonOrganizationBindingMismatch BetaThinkingDroppedInputTransformationReason = "organization_binding_mismatch"
 11258  	BetaThinkingDroppedInputTransformationReasonEndUserBindingMismatch      BetaThinkingDroppedInputTransformationReason = "end_user_binding_mismatch"
 11259  )
 11260  
 11261  // What happens when a thinking block in `messages` fails the conversation check:
 11262  // it was created in a different conversation, or the messages before it have
 11263  // changed since. `"error"` (the default) fails the request with a 400 error.
 11264  // `"drop_block"` removes the failing blocks and the request proceeds; the model no
 11265  // longer sees the dropped reasoning.
 11266  type BetaThinkingPrefixMismatchBehavior string
 11267  
 11268  const (
 11269  	BetaThinkingPrefixMismatchBehaviorError     BetaThinkingPrefixMismatchBehavior = "error"
 11270  	BetaThinkingPrefixMismatchBehaviorDropBlock BetaThinkingPrefixMismatchBehavior = "drop_block"
 11271  )
 11272  
 11273  // The properties Type, Value are required.
 11274  type BetaThinkingTurnsParam struct {
 11275  	Value int64 `json:"value" api:"required"`
 11276  	// This field can be elided, and will marshal its zero value as "thinking_turns".
 11277  	Type constant.ThinkingTurns `json:"type" default:"thinking_turns"`
 11278  	paramObj
 11279  }
 11280  
 11281  func (r BetaThinkingTurnsParam) MarshalJSON() (data []byte, err error) {
 11282  	type shadow BetaThinkingTurnsParam
 11283  	return param.MarshalObject(r, (*shadow)(&r))
 11284  }
 11285  func (r *BetaThinkingTurnsParam) UnmarshalJSON(data []byte) error {
 11286  	return apijson.UnmarshalRoot(data, r)
 11287  }
 11288  
 11289  // User-configurable total token budget across contexts.
 11290  //
 11291  // The properties Total, Type are required.
 11292  type BetaTokenTaskBudgetParam struct {
 11293  	// Total token budget across all contexts in the session.
 11294  	Total int64 `json:"total" api:"required"`
 11295  	// Remaining tokens in the budget. Use this to track usage across contexts when
 11296  	// implementing compaction client-side. Defaults to total if not provided.
 11297  	Remaining param.Opt[int64] `json:"remaining,omitzero"`
 11298  	// The budget type. Currently only 'tokens' is supported.
 11299  	//
 11300  	// This field can be elided, and will marshal its zero value as "tokens".
 11301  	Type constant.Tokens `json:"type" default:"tokens"`
 11302  	paramObj
 11303  }
 11304  
 11305  func (r BetaTokenTaskBudgetParam) MarshalJSON() (data []byte, err error) {
 11306  	type shadow BetaTokenTaskBudgetParam
 11307  	return param.MarshalObject(r, (*shadow)(&r))
 11308  }
 11309  func (r *BetaTokenTaskBudgetParam) UnmarshalJSON(data []byte) error {
 11310  	return apijson.UnmarshalRoot(data, r)
 11311  }
 11312  
 11313  // The properties InputSchema, Name are required.
 11314  type BetaToolParam struct {
 11315  	// [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
 11316  	//
 11317  	// This defines the shape of the `input` that your tool accepts and that the model
 11318  	// will produce.
 11319  	InputSchema BetaToolInputSchemaParam `json:"input_schema,omitzero" api:"required"`
 11320  	// Name of the tool.
 11321  	//
 11322  	// This is how the tool will be called by the model and in `tool_use` blocks.
 11323  	Name string `json:"name" api:"required"`
 11324  	// Enable eager input streaming for this tool. When true, tool input parameters
 11325  	// will be streamed incrementally as they are generated, and types will be inferred
 11326  	// on-the-fly rather than buffering the full JSON output. When false, streaming is
 11327  	// disabled for this tool even if the fine-grained-tool-streaming beta is active.
 11328  	// When null (default), uses the default behavior based on beta headers.
 11329  	EagerInputStreaming param.Opt[bool] `json:"eager_input_streaming,omitzero"`
 11330  	// If true, tool will not be included in initial system prompt. Only loaded when
 11331  	// returned via tool_reference from tool search.
 11332  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 11333  	// Description of what this tool does.
 11334  	//
 11335  	// Tool descriptions should be as detailed as possible. The more information that
 11336  	// the model has about what the tool is and how to use it, the better it will
 11337  	// perform. You can use natural language descriptions to reinforce important
 11338  	// aspects of the tool input JSON schema.
 11339  	Description param.Opt[string] `json:"description,omitzero"`
 11340  	// When true, guarantees schema validation on tool names and inputs
 11341  	Strict param.Opt[bool] `json:"strict,omitzero"`
 11342  	// Any of "custom".
 11343  	Type BetaToolType `json:"type,omitzero"`
 11344  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 11345  	// "code_execution_20260521".
 11346  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 11347  	// Create a cache control breakpoint at this content block.
 11348  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 11349  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 11350  	paramObj
 11351  }
 11352  
 11353  func (r BetaToolParam) MarshalJSON() (data []byte, err error) {
 11354  	type shadow BetaToolParam
 11355  	return param.MarshalObject(r, (*shadow)(&r))
 11356  }
 11357  func (r *BetaToolParam) UnmarshalJSON(data []byte) error {
 11358  	return apijson.UnmarshalRoot(data, r)
 11359  }
 11360  
 11361  // [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
 11362  //
 11363  // This defines the shape of the `input` that your tool accepts and that the model
 11364  // will produce.
 11365  //
 11366  // The property Type is required.
 11367  type BetaToolInputSchemaParam struct {
 11368  	Properties any      `json:"properties,omitzero"`
 11369  	Required   []string `json:"required,omitzero"`
 11370  	// This field can be elided, and will marshal its zero value as "object".
 11371  	Type        constant.Object `json:"type" default:"object"`
 11372  	ExtraFields map[string]any  `json:"-"`
 11373  	paramObj
 11374  }
 11375  
 11376  func (r BetaToolInputSchemaParam) MarshalJSON() (data []byte, err error) {
 11377  	type shadow BetaToolInputSchemaParam
 11378  	return param.MarshalWithExtras(r, (*shadow)(&r), r.ExtraFields)
 11379  }
 11380  func (r *BetaToolInputSchemaParam) UnmarshalJSON(data []byte) error {
 11381  	return apijson.UnmarshalRoot(data, r)
 11382  }
 11383  
 11384  type BetaToolType string
 11385  
 11386  const (
 11387  	BetaToolTypeCustom BetaToolType = "custom"
 11388  )
 11389  
 11390  // The properties Name, Type are required.
 11391  type BetaToolBash20241022Param struct {
 11392  	// If true, tool will not be included in initial system prompt. Only loaded when
 11393  	// returned via tool_reference from tool search.
 11394  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 11395  	// When true, guarantees schema validation on tool names and inputs
 11396  	Strict param.Opt[bool] `json:"strict,omitzero"`
 11397  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 11398  	// "code_execution_20260521".
 11399  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 11400  	// Create a cache control breakpoint at this content block.
 11401  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 11402  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 11403  	// Name of the tool.
 11404  	//
 11405  	// This is how the tool will be called by the model and in `tool_use` blocks.
 11406  	//
 11407  	// This field can be elided, and will marshal its zero value as "bash".
 11408  	Name constant.Bash `json:"name" default:"bash"`
 11409  	// This field can be elided, and will marshal its zero value as "bash_20241022".
 11410  	Type constant.Bash20241022 `json:"type" default:"bash_20241022"`
 11411  	paramObj
 11412  }
 11413  
 11414  func (r BetaToolBash20241022Param) MarshalJSON() (data []byte, err error) {
 11415  	type shadow BetaToolBash20241022Param
 11416  	return param.MarshalObject(r, (*shadow)(&r))
 11417  }
 11418  func (r *BetaToolBash20241022Param) UnmarshalJSON(data []byte) error {
 11419  	return apijson.UnmarshalRoot(data, r)
 11420  }
 11421  
 11422  // The properties Name, Type are required.
 11423  type BetaToolBash20250124Param struct {
 11424  	// If true, tool will not be included in initial system prompt. Only loaded when
 11425  	// returned via tool_reference from tool search.
 11426  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 11427  	// When true, guarantees schema validation on tool names and inputs
 11428  	Strict param.Opt[bool] `json:"strict,omitzero"`
 11429  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 11430  	// "code_execution_20260521".
 11431  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 11432  	// Create a cache control breakpoint at this content block.
 11433  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 11434  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 11435  	// Name of the tool.
 11436  	//
 11437  	// This is how the tool will be called by the model and in `tool_use` blocks.
 11438  	//
 11439  	// This field can be elided, and will marshal its zero value as "bash".
 11440  	Name constant.Bash `json:"name" default:"bash"`
 11441  	// This field can be elided, and will marshal its zero value as "bash_20250124".
 11442  	Type constant.Bash20250124 `json:"type" default:"bash_20250124"`
 11443  	paramObj
 11444  }
 11445  
 11446  func (r BetaToolBash20250124Param) MarshalJSON() (data []byte, err error) {
 11447  	type shadow BetaToolBash20250124Param
 11448  	return param.MarshalObject(r, (*shadow)(&r))
 11449  }
 11450  func (r *BetaToolBash20250124Param) UnmarshalJSON(data []byte) error {
 11451  	return apijson.UnmarshalRoot(data, r)
 11452  }
 11453  
 11454  // Reference to a single MCP tool by its server and remote name — the same
 11455  // `server_name`/`name` pair `mcp_tool_use` carries.
 11456  //
 11457  // The properties Name, ServerName, Type are required.
 11458  type BetaToolChangeMCPToolReferenceParam struct {
 11459  	Name       string `json:"name" api:"required"`
 11460  	ServerName string `json:"server_name" api:"required"`
 11461  	// This field can be elided, and will marshal its zero value as
 11462  	// "mcp_tool_reference".
 11463  	Type constant.MCPToolReference `json:"type" default:"mcp_tool_reference"`
 11464  	paramObj
 11465  }
 11466  
 11467  func (r BetaToolChangeMCPToolReferenceParam) MarshalJSON() (data []byte, err error) {
 11468  	type shadow BetaToolChangeMCPToolReferenceParam
 11469  	return param.MarshalObject(r, (*shadow)(&r))
 11470  }
 11471  func (r *BetaToolChangeMCPToolReferenceParam) UnmarshalJSON(data []byte) error {
 11472  	return apijson.UnmarshalRoot(data, r)
 11473  }
 11474  
 11475  // Reference to every tool in the named MCP server's toolset.
 11476  //
 11477  // The properties ServerName, Type are required.
 11478  type BetaToolChangeMCPToolsetReferenceParam struct {
 11479  	ServerName string `json:"server_name" api:"required"`
 11480  	// This field can be elided, and will marshal its zero value as
 11481  	// "mcp_toolset_reference".
 11482  	Type constant.MCPToolsetReference `json:"type" default:"mcp_toolset_reference"`
 11483  	paramObj
 11484  }
 11485  
 11486  func (r BetaToolChangeMCPToolsetReferenceParam) MarshalJSON() (data []byte, err error) {
 11487  	type shadow BetaToolChangeMCPToolsetReferenceParam
 11488  	return param.MarshalObject(r, (*shadow)(&r))
 11489  }
 11490  func (r *BetaToolChangeMCPToolsetReferenceParam) UnmarshalJSON(data []byte) error {
 11491  	return apijson.UnmarshalRoot(data, r)
 11492  }
 11493  
 11494  // Reference to a single tool the caller declared directly in `tools[]`. Does not
 11495  // accept the composed `{server}_{name}` form the server assigns to MCP-resolved
 11496  // tools — use `mcp_tool_reference` or `mcp_toolset_reference` for those.
 11497  //
 11498  // The properties Name, Type are required.
 11499  type BetaToolChangeToolReferenceParam struct {
 11500  	Name string `json:"name" api:"required"`
 11501  	// This field can be elided, and will marshal its zero value as "tool_reference".
 11502  	Type constant.ToolReference `json:"type" default:"tool_reference"`
 11503  	paramObj
 11504  }
 11505  
 11506  func (r BetaToolChangeToolReferenceParam) MarshalJSON() (data []byte, err error) {
 11507  	type shadow BetaToolChangeToolReferenceParam
 11508  	return param.MarshalObject(r, (*shadow)(&r))
 11509  }
 11510  func (r *BetaToolChangeToolReferenceParam) UnmarshalJSON(data []byte) error {
 11511  	return apijson.UnmarshalRoot(data, r)
 11512  }
 11513  
 11514  func BetaToolChoiceParamOfTool(name string) BetaToolChoiceUnionParam {
 11515  	var tool BetaToolChoiceToolParam
 11516  	tool.Name = name
 11517  	return BetaToolChoiceUnionParam{OfTool: &tool}
 11518  }
 11519  
 11520  // Only one field can be non-zero.
 11521  //
 11522  // Use [param.IsOmitted] to confirm if a field is set.
 11523  type BetaToolChoiceUnionParam struct {
 11524  	OfAuto *BetaToolChoiceAutoParam `json:",omitzero,inline"`
 11525  	OfAny  *BetaToolChoiceAnyParam  `json:",omitzero,inline"`
 11526  	OfTool *BetaToolChoiceToolParam `json:",omitzero,inline"`
 11527  	OfNone *BetaToolChoiceNoneParam `json:",omitzero,inline"`
 11528  	paramUnion
 11529  }
 11530  
 11531  func (u BetaToolChoiceUnionParam) MarshalJSON() ([]byte, error) {
 11532  	return param.MarshalUnion(u, u.OfAuto, u.OfAny, u.OfTool, u.OfNone)
 11533  }
 11534  func (u *BetaToolChoiceUnionParam) UnmarshalJSON(data []byte) error {
 11535  	return apijson.UnmarshalRoot(data, u)
 11536  }
 11537  
 11538  func (u *BetaToolChoiceUnionParam) asAny() any {
 11539  	if !param.IsOmitted(u.OfAuto) {
 11540  		return u.OfAuto
 11541  	} else if !param.IsOmitted(u.OfAny) {
 11542  		return u.OfAny
 11543  	} else if !param.IsOmitted(u.OfTool) {
 11544  		return u.OfTool
 11545  	} else if !param.IsOmitted(u.OfNone) {
 11546  		return u.OfNone
 11547  	}
 11548  	return nil
 11549  }
 11550  
 11551  // Returns a pointer to the underlying variant's property, if present.
 11552  func (u BetaToolChoiceUnionParam) GetName() *string {
 11553  	if vt := u.OfTool; vt != nil {
 11554  		return &vt.Name
 11555  	}
 11556  	return nil
 11557  }
 11558  
 11559  // Returns a pointer to the underlying variant's property, if present.
 11560  func (u BetaToolChoiceUnionParam) GetType() *string {
 11561  	if vt := u.OfAuto; vt != nil {
 11562  		return (*string)(&vt.Type)
 11563  	} else if vt := u.OfAny; vt != nil {
 11564  		return (*string)(&vt.Type)
 11565  	} else if vt := u.OfTool; vt != nil {
 11566  		return (*string)(&vt.Type)
 11567  	} else if vt := u.OfNone; vt != nil {
 11568  		return (*string)(&vt.Type)
 11569  	}
 11570  	return nil
 11571  }
 11572  
 11573  // Returns a pointer to the underlying variant's property, if present.
 11574  func (u BetaToolChoiceUnionParam) GetDisableParallelToolUse() *bool {
 11575  	if vt := u.OfAuto; vt != nil && vt.DisableParallelToolUse.Valid() {
 11576  		return &vt.DisableParallelToolUse.Value
 11577  	} else if vt := u.OfAny; vt != nil && vt.DisableParallelToolUse.Valid() {
 11578  		return &vt.DisableParallelToolUse.Value
 11579  	} else if vt := u.OfTool; vt != nil && vt.DisableParallelToolUse.Valid() {
 11580  		return &vt.DisableParallelToolUse.Value
 11581  	}
 11582  	return nil
 11583  }
 11584  
 11585  func init() {
 11586  	apijson.RegisterUnion[BetaToolChoiceUnionParam](
 11587  		"type",
 11588  		apijson.Discriminator[BetaToolChoiceAutoParam]("auto"),
 11589  		apijson.Discriminator[BetaToolChoiceAnyParam]("any"),
 11590  		apijson.Discriminator[BetaToolChoiceToolParam]("tool"),
 11591  		apijson.Discriminator[BetaToolChoiceNoneParam]("none"),
 11592  	)
 11593  }
 11594  
 11595  // The model will use any available tools.
 11596  //
 11597  // The property Type is required.
 11598  type BetaToolChoiceAnyParam struct {
 11599  	// Whether to disable parallel tool use.
 11600  	//
 11601  	// Defaults to `false`. If set to `true`, the model will output exactly one tool
 11602  	// use.
 11603  	DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
 11604  	// This field can be elided, and will marshal its zero value as "any".
 11605  	Type constant.Any `json:"type" default:"any"`
 11606  	paramObj
 11607  }
 11608  
 11609  func (r BetaToolChoiceAnyParam) MarshalJSON() (data []byte, err error) {
 11610  	type shadow BetaToolChoiceAnyParam
 11611  	return param.MarshalObject(r, (*shadow)(&r))
 11612  }
 11613  func (r *BetaToolChoiceAnyParam) UnmarshalJSON(data []byte) error {
 11614  	return apijson.UnmarshalRoot(data, r)
 11615  }
 11616  
 11617  // The model will automatically decide whether to use tools.
 11618  //
 11619  // The property Type is required.
 11620  type BetaToolChoiceAutoParam struct {
 11621  	// Whether to disable parallel tool use.
 11622  	//
 11623  	// Defaults to `false`. If set to `true`, the model will output at most one tool
 11624  	// use.
 11625  	DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
 11626  	// This field can be elided, and will marshal its zero value as "auto".
 11627  	Type constant.Auto `json:"type" default:"auto"`
 11628  	paramObj
 11629  }
 11630  
 11631  func (r BetaToolChoiceAutoParam) MarshalJSON() (data []byte, err error) {
 11632  	type shadow BetaToolChoiceAutoParam
 11633  	return param.MarshalObject(r, (*shadow)(&r))
 11634  }
 11635  func (r *BetaToolChoiceAutoParam) UnmarshalJSON(data []byte) error {
 11636  	return apijson.UnmarshalRoot(data, r)
 11637  }
 11638  
 11639  func NewBetaToolChoiceNoneParam() BetaToolChoiceNoneParam {
 11640  	return BetaToolChoiceNoneParam{
 11641  		Type: "none",
 11642  	}
 11643  }
 11644  
 11645  // The model will not be allowed to use tools.
 11646  //
 11647  // This struct has a constant value, construct it with
 11648  // [NewBetaToolChoiceNoneParam].
 11649  type BetaToolChoiceNoneParam struct {
 11650  	Type constant.None `json:"type" default:"none"`
 11651  	paramObj
 11652  }
 11653  
 11654  func (r BetaToolChoiceNoneParam) MarshalJSON() (data []byte, err error) {
 11655  	type shadow BetaToolChoiceNoneParam
 11656  	return param.MarshalObject(r, (*shadow)(&r))
 11657  }
 11658  func (r *BetaToolChoiceNoneParam) UnmarshalJSON(data []byte) error {
 11659  	return apijson.UnmarshalRoot(data, r)
 11660  }
 11661  
 11662  // The model will use the specified tool with `tool_choice.name`.
 11663  //
 11664  // The properties Name, Type are required.
 11665  type BetaToolChoiceToolParam struct {
 11666  	// The name of the tool to use.
 11667  	Name string `json:"name" api:"required"`
 11668  	// Whether to disable parallel tool use.
 11669  	//
 11670  	// Defaults to `false`. If set to `true`, the model will output exactly one tool
 11671  	// use.
 11672  	DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
 11673  	// This field can be elided, and will marshal its zero value as "tool".
 11674  	Type constant.Tool `json:"type" default:"tool"`
 11675  	paramObj
 11676  }
 11677  
 11678  func (r BetaToolChoiceToolParam) MarshalJSON() (data []byte, err error) {
 11679  	type shadow BetaToolChoiceToolParam
 11680  	return param.MarshalObject(r, (*shadow)(&r))
 11681  }
 11682  func (r *BetaToolChoiceToolParam) UnmarshalJSON(data []byte) error {
 11683  	return apijson.UnmarshalRoot(data, r)
 11684  }
 11685  
 11686  // The properties DisplayHeightPx, DisplayWidthPx, Name, Type are required.
 11687  type BetaToolComputerUse20241022Param struct {
 11688  	// The height of the display in pixels.
 11689  	DisplayHeightPx int64 `json:"display_height_px" api:"required"`
 11690  	// The width of the display in pixels.
 11691  	DisplayWidthPx int64 `json:"display_width_px" api:"required"`
 11692  	// The X11 display number (e.g. 0, 1) for the display.
 11693  	DisplayNumber param.Opt[int64] `json:"display_number,omitzero"`
 11694  	// If true, tool will not be included in initial system prompt. Only loaded when
 11695  	// returned via tool_reference from tool search.
 11696  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 11697  	// When true, guarantees schema validation on tool names and inputs
 11698  	Strict param.Opt[bool] `json:"strict,omitzero"`
 11699  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 11700  	// "code_execution_20260521".
 11701  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 11702  	// Create a cache control breakpoint at this content block.
 11703  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 11704  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 11705  	// Name of the tool.
 11706  	//
 11707  	// This is how the tool will be called by the model and in `tool_use` blocks.
 11708  	//
 11709  	// This field can be elided, and will marshal its zero value as "computer".
 11710  	Name constant.Computer `json:"name" default:"computer"`
 11711  	// This field can be elided, and will marshal its zero value as
 11712  	// "computer_20241022".
 11713  	Type constant.Computer20241022 `json:"type" default:"computer_20241022"`
 11714  	paramObj
 11715  }
 11716  
 11717  func (r BetaToolComputerUse20241022Param) MarshalJSON() (data []byte, err error) {
 11718  	type shadow BetaToolComputerUse20241022Param
 11719  	return param.MarshalObject(r, (*shadow)(&r))
 11720  }
 11721  func (r *BetaToolComputerUse20241022Param) UnmarshalJSON(data []byte) error {
 11722  	return apijson.UnmarshalRoot(data, r)
 11723  }
 11724  
 11725  // The properties DisplayHeightPx, DisplayWidthPx, Name, Type are required.
 11726  type BetaToolComputerUse20250124Param struct {
 11727  	// The height of the display in pixels.
 11728  	DisplayHeightPx int64 `json:"display_height_px" api:"required"`
 11729  	// The width of the display in pixels.
 11730  	DisplayWidthPx int64 `json:"display_width_px" api:"required"`
 11731  	// The X11 display number (e.g. 0, 1) for the display.
 11732  	DisplayNumber param.Opt[int64] `json:"display_number,omitzero"`
 11733  	// If true, tool will not be included in initial system prompt. Only loaded when
 11734  	// returned via tool_reference from tool search.
 11735  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 11736  	// When true, guarantees schema validation on tool names and inputs
 11737  	Strict param.Opt[bool] `json:"strict,omitzero"`
 11738  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 11739  	// "code_execution_20260521".
 11740  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 11741  	// Create a cache control breakpoint at this content block.
 11742  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 11743  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 11744  	// Name of the tool.
 11745  	//
 11746  	// This is how the tool will be called by the model and in `tool_use` blocks.
 11747  	//
 11748  	// This field can be elided, and will marshal its zero value as "computer".
 11749  	Name constant.Computer `json:"name" default:"computer"`
 11750  	// This field can be elided, and will marshal its zero value as
 11751  	// "computer_20250124".
 11752  	Type constant.Computer20250124 `json:"type" default:"computer_20250124"`
 11753  	paramObj
 11754  }
 11755  
 11756  func (r BetaToolComputerUse20250124Param) MarshalJSON() (data []byte, err error) {
 11757  	type shadow BetaToolComputerUse20250124Param
 11758  	return param.MarshalObject(r, (*shadow)(&r))
 11759  }
 11760  func (r *BetaToolComputerUse20250124Param) UnmarshalJSON(data []byte) error {
 11761  	return apijson.UnmarshalRoot(data, r)
 11762  }
 11763  
 11764  // The properties DisplayHeightPx, DisplayWidthPx, Name, Type are required.
 11765  type BetaToolComputerUse20251124Param struct {
 11766  	// The height of the display in pixels.
 11767  	DisplayHeightPx int64 `json:"display_height_px" api:"required"`
 11768  	// The width of the display in pixels.
 11769  	DisplayWidthPx int64 `json:"display_width_px" api:"required"`
 11770  	// The X11 display number (e.g. 0, 1) for the display.
 11771  	DisplayNumber param.Opt[int64] `json:"display_number,omitzero"`
 11772  	// If true, tool will not be included in initial system prompt. Only loaded when
 11773  	// returned via tool_reference from tool search.
 11774  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 11775  	// Whether to enable an action to take a zoomed-in screenshot of the screen.
 11776  	EnableZoom param.Opt[bool] `json:"enable_zoom,omitzero"`
 11777  	// When true, guarantees schema validation on tool names and inputs
 11778  	Strict param.Opt[bool] `json:"strict,omitzero"`
 11779  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 11780  	// "code_execution_20260521".
 11781  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 11782  	// Create a cache control breakpoint at this content block.
 11783  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 11784  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 11785  	// Name of the tool.
 11786  	//
 11787  	// This is how the tool will be called by the model and in `tool_use` blocks.
 11788  	//
 11789  	// This field can be elided, and will marshal its zero value as "computer".
 11790  	Name constant.Computer `json:"name" default:"computer"`
 11791  	// This field can be elided, and will marshal its zero value as
 11792  	// "computer_20251124".
 11793  	Type constant.Computer20251124 `json:"type" default:"computer_20251124"`
 11794  	paramObj
 11795  }
 11796  
 11797  func (r BetaToolComputerUse20251124Param) MarshalJSON() (data []byte, err error) {
 11798  	type shadow BetaToolComputerUse20251124Param
 11799  	return param.MarshalObject(r, (*shadow)(&r))
 11800  }
 11801  func (r *BetaToolComputerUse20251124Param) UnmarshalJSON(data []byte) error {
 11802  	return apijson.UnmarshalRoot(data, r)
 11803  }
 11804  
 11805  type BetaToolReferenceBlock struct {
 11806  	ToolName string                 `json:"tool_name" api:"required"`
 11807  	Type     constant.ToolReference `json:"type" default:"tool_reference"`
 11808  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 11809  	JSON struct {
 11810  		ToolName    respjson.Field
 11811  		Type        respjson.Field
 11812  		ExtraFields map[string]respjson.Field
 11813  		raw         string
 11814  	} `json:"-"`
 11815  }
 11816  
 11817  // Returns the unmodified JSON received from the API
 11818  func (r BetaToolReferenceBlock) RawJSON() string { return r.JSON.raw }
 11819  func (r *BetaToolReferenceBlock) UnmarshalJSON(data []byte) error {
 11820  	return apijson.UnmarshalRoot(data, r)
 11821  }
 11822  
 11823  // Tool reference block that can be included in tool_result content.
 11824  //
 11825  // The properties ToolName, Type are required.
 11826  type BetaToolReferenceBlockParam struct {
 11827  	ToolName string `json:"tool_name" api:"required"`
 11828  	// Create a cache control breakpoint at this content block.
 11829  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 11830  	// This field can be elided, and will marshal its zero value as "tool_reference".
 11831  	Type constant.ToolReference `json:"type" default:"tool_reference"`
 11832  	paramObj
 11833  }
 11834  
 11835  func (r BetaToolReferenceBlockParam) MarshalJSON() (data []byte, err error) {
 11836  	type shadow BetaToolReferenceBlockParam
 11837  	return param.MarshalObject(r, (*shadow)(&r))
 11838  }
 11839  func (r *BetaToolReferenceBlockParam) UnmarshalJSON(data []byte) error {
 11840  	return apijson.UnmarshalRoot(data, r)
 11841  }
 11842  
 11843  // The properties ToolUseID, Type are required.
 11844  type BetaToolResultBlockParam struct {
 11845  	ToolUseID string `json:"tool_use_id" api:"required"`
 11846  	// For a toolset member tool_result, the toolset family of the paired tool_use.
 11847  	ToolsetName param.Opt[string] `json:"toolset_name,omitzero"`
 11848  	IsError     param.Opt[bool]   `json:"is_error,omitzero"`
 11849  	// Create a cache control breakpoint at this content block.
 11850  	CacheControl BetaCacheControlEphemeralParam         `json:"cache_control,omitzero"`
 11851  	Content      []BetaToolResultBlockParamContentUnion `json:"content,omitzero"`
 11852  	// This field can be elided, and will marshal its zero value as "tool_result".
 11853  	Type constant.ToolResult `json:"type" default:"tool_result"`
 11854  	paramObj
 11855  }
 11856  
 11857  func (r BetaToolResultBlockParam) MarshalJSON() (data []byte, err error) {
 11858  	type shadow BetaToolResultBlockParam
 11859  	return param.MarshalObject(r, (*shadow)(&r))
 11860  }
 11861  func (r *BetaToolResultBlockParam) UnmarshalJSON(data []byte) error {
 11862  	return apijson.UnmarshalRoot(data, r)
 11863  }
 11864  
 11865  func NewBetaToolResultTextBlockParam(toolUseID string, text string, isError bool) BetaToolResultBlockParam {
 11866  	var p BetaToolResultBlockParam
 11867  	p.ToolUseID = toolUseID
 11868  	p.IsError = param.Opt[bool]{Value: isError}
 11869  	p.Content = []BetaToolResultBlockParamContentUnion{
 11870  		{OfText: &BetaTextBlockParam{Text: text}},
 11871  	}
 11872  	return p
 11873  }
 11874  
 11875  // Only one field can be non-zero.
 11876  //
 11877  // Use [param.IsOmitted] to confirm if a field is set.
 11878  type BetaToolResultBlockParamContentUnion struct {
 11879  	OfText          *BetaTextBlockParam            `json:",omitzero,inline"`
 11880  	OfImage         *BetaImageBlockParam           `json:",omitzero,inline"`
 11881  	OfSearchResult  *BetaSearchResultBlockParam    `json:",omitzero,inline"`
 11882  	OfDocument      *BetaRequestDocumentBlockParam `json:",omitzero,inline"`
 11883  	OfToolReference *BetaToolReferenceBlockParam   `json:",omitzero,inline"`
 11884  	OfBrowserState  *BetaBrowserStateBlockParam    `json:",omitzero,inline"`
 11885  	paramUnion
 11886  }
 11887  
 11888  func (u BetaToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
 11889  	return param.MarshalUnion(u, u.OfText,
 11890  		u.OfImage,
 11891  		u.OfSearchResult,
 11892  		u.OfDocument,
 11893  		u.OfToolReference,
 11894  		u.OfBrowserState)
 11895  }
 11896  func (u *BetaToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
 11897  	return apijson.UnmarshalRoot(data, u)
 11898  }
 11899  
 11900  func (u *BetaToolResultBlockParamContentUnion) asAny() any {
 11901  	if !param.IsOmitted(u.OfText) {
 11902  		return u.OfText
 11903  	} else if !param.IsOmitted(u.OfImage) {
 11904  		return u.OfImage
 11905  	} else if !param.IsOmitted(u.OfSearchResult) {
 11906  		return u.OfSearchResult
 11907  	} else if !param.IsOmitted(u.OfDocument) {
 11908  		return u.OfDocument
 11909  	} else if !param.IsOmitted(u.OfToolReference) {
 11910  		return u.OfToolReference
 11911  	} else if !param.IsOmitted(u.OfBrowserState) {
 11912  		return u.OfBrowserState
 11913  	}
 11914  	return nil
 11915  }
 11916  
 11917  // Returns a pointer to the underlying variant's property, if present.
 11918  func (u BetaToolResultBlockParamContentUnion) GetText() *string {
 11919  	if vt := u.OfText; vt != nil {
 11920  		return &vt.Text
 11921  	}
 11922  	return nil
 11923  }
 11924  
 11925  // Returns a pointer to the underlying variant's property, if present.
 11926  func (u BetaToolResultBlockParamContentUnion) GetTransformations() *BetaImageTransformationsParam {
 11927  	if vt := u.OfImage; vt != nil {
 11928  		return &vt.Transformations
 11929  	}
 11930  	return nil
 11931  }
 11932  
 11933  // Returns a pointer to the underlying variant's property, if present.
 11934  func (u BetaToolResultBlockParamContentUnion) GetContent() []BetaTextBlockParam {
 11935  	if vt := u.OfSearchResult; vt != nil {
 11936  		return vt.Content
 11937  	}
 11938  	return nil
 11939  }
 11940  
 11941  // Returns a pointer to the underlying variant's property, if present.
 11942  func (u BetaToolResultBlockParamContentUnion) GetContext() *string {
 11943  	if vt := u.OfDocument; vt != nil && vt.Context.Valid() {
 11944  		return &vt.Context.Value
 11945  	}
 11946  	return nil
 11947  }
 11948  
 11949  // Returns a pointer to the underlying variant's property, if present.
 11950  func (u BetaToolResultBlockParamContentUnion) GetToolName() *string {
 11951  	if vt := u.OfToolReference; vt != nil {
 11952  		return &vt.ToolName
 11953  	}
 11954  	return nil
 11955  }
 11956  
 11957  // Returns a pointer to the underlying variant's property, if present.
 11958  func (u BetaToolResultBlockParamContentUnion) GetTabs() []BetaBrowserStateTabEntryParam {
 11959  	if vt := u.OfBrowserState; vt != nil {
 11960  		return vt.Tabs
 11961  	}
 11962  	return nil
 11963  }
 11964  
 11965  // Returns a pointer to the underlying variant's property, if present.
 11966  func (u BetaToolResultBlockParamContentUnion) GetStateChanges() []BetaBrowserStateChangeUnionParam {
 11967  	if vt := u.OfBrowserState; vt != nil {
 11968  		return vt.StateChanges
 11969  	}
 11970  	return nil
 11971  }
 11972  
 11973  // Returns a pointer to the underlying variant's property, if present.
 11974  func (u BetaToolResultBlockParamContentUnion) GetType() *string {
 11975  	if vt := u.OfText; vt != nil {
 11976  		return (*string)(&vt.Type)
 11977  	} else if vt := u.OfImage; vt != nil {
 11978  		return (*string)(&vt.Type)
 11979  	} else if vt := u.OfSearchResult; vt != nil {
 11980  		return (*string)(&vt.Type)
 11981  	} else if vt := u.OfDocument; vt != nil {
 11982  		return (*string)(&vt.Type)
 11983  	} else if vt := u.OfToolReference; vt != nil {
 11984  		return (*string)(&vt.Type)
 11985  	} else if vt := u.OfBrowserState; vt != nil {
 11986  		return (*string)(&vt.Type)
 11987  	}
 11988  	return nil
 11989  }
 11990  
 11991  // Returns a pointer to the underlying variant's property, if present.
 11992  func (u BetaToolResultBlockParamContentUnion) GetTitle() *string {
 11993  	if vt := u.OfSearchResult; vt != nil {
 11994  		return (*string)(&vt.Title)
 11995  	} else if vt := u.OfDocument; vt != nil && vt.Title.Valid() {
 11996  		return &vt.Title.Value
 11997  	}
 11998  	return nil
 11999  }
 12000  
 12001  // Returns a pointer to the underlying variant's CacheControl property, if present.
 12002  func (u BetaToolResultBlockParamContentUnion) GetCacheControl() *BetaCacheControlEphemeralParam {
 12003  	if vt := u.OfText; vt != nil {
 12004  		return &vt.CacheControl
 12005  	} else if vt := u.OfImage; vt != nil {
 12006  		return &vt.CacheControl
 12007  	} else if vt := u.OfSearchResult; vt != nil {
 12008  		return &vt.CacheControl
 12009  	} else if vt := u.OfDocument; vt != nil {
 12010  		return &vt.CacheControl
 12011  	} else if vt := u.OfToolReference; vt != nil {
 12012  		return &vt.CacheControl
 12013  	} else if vt := u.OfBrowserState; vt != nil {
 12014  		return &vt.CacheControl
 12015  	}
 12016  	return nil
 12017  }
 12018  
 12019  // Returns a subunion which exports methods to access subproperties
 12020  //
 12021  // Or use AsAny() to get the underlying value
 12022  func (u BetaToolResultBlockParamContentUnion) GetCitations() (res betaToolResultBlockParamContentUnionCitations) {
 12023  	if vt := u.OfText; vt != nil {
 12024  		res.any = &vt.Citations
 12025  	} else if vt := u.OfSearchResult; vt != nil {
 12026  		res.any = &vt.Citations
 12027  	} else if vt := u.OfDocument; vt != nil {
 12028  		res.any = &vt.Citations
 12029  	}
 12030  	return
 12031  }
 12032  
 12033  // Can have the runtime types [*[]BetaTextCitationParamUnion],
 12034  // [*BetaCitationsConfigParam]
 12035  type betaToolResultBlockParamContentUnionCitations struct{ any }
 12036  
 12037  // Use the following switch statement to get the type of the union:
 12038  //
 12039  //	switch u.AsAny().(type) {
 12040  //	case *[]anthropic.BetaTextCitationParamUnion:
 12041  //	case *anthropic.BetaCitationsConfigParam:
 12042  //	default:
 12043  //	    fmt.Errorf("not present")
 12044  //	}
 12045  func (u betaToolResultBlockParamContentUnionCitations) AsAny() any { return u.any }
 12046  
 12047  // Returns a pointer to the underlying variant's property, if present.
 12048  func (u betaToolResultBlockParamContentUnionCitations) GetEnabled() *bool {
 12049  	switch vt := u.any.(type) {
 12050  	case *BetaCitationsConfigParam:
 12051  		return paramutil.AddrIfPresent(vt.Enabled)
 12052  	}
 12053  	return nil
 12054  }
 12055  
 12056  // Returns a subunion which exports methods to access subproperties
 12057  //
 12058  // Or use AsAny() to get the underlying value
 12059  func (u BetaToolResultBlockParamContentUnion) GetSource() (res betaToolResultBlockParamContentUnionSource) {
 12060  	if vt := u.OfImage; vt != nil {
 12061  		res.any = vt.Source.asAny()
 12062  	} else if vt := u.OfSearchResult; vt != nil {
 12063  		res.any = &vt.Source
 12064  	} else if vt := u.OfDocument; vt != nil {
 12065  		res.any = vt.Source.asAny()
 12066  	}
 12067  	return
 12068  }
 12069  
 12070  // Can have the runtime types [*BetaBase64ImageSourceParam],
 12071  // [*BetaURLImageSourceParam], [*BetaFileImageSourceParam], [*string],
 12072  // [*BetaBase64PDFSourceParam], [*BetaPlainTextSourceParam],
 12073  // [*BetaContentBlockSourceParam], [*BetaURLPDFSourceParam],
 12074  // [*BetaFileDocumentSourceParam]
 12075  type betaToolResultBlockParamContentUnionSource struct{ any }
 12076  
 12077  // Use the following switch statement to get the type of the union:
 12078  //
 12079  //	switch u.AsAny().(type) {
 12080  //	case *anthropic.BetaBase64ImageSourceParam:
 12081  //	case *anthropic.BetaURLImageSourceParam:
 12082  //	case *anthropic.BetaFileImageSourceParam:
 12083  //	case *string:
 12084  //	case *anthropic.BetaBase64PDFSourceParam:
 12085  //	case *anthropic.BetaPlainTextSourceParam:
 12086  //	case *anthropic.BetaContentBlockSourceParam:
 12087  //	case *anthropic.BetaURLPDFSourceParam:
 12088  //	case *anthropic.BetaFileDocumentSourceParam:
 12089  //	default:
 12090  //	    fmt.Errorf("not present")
 12091  //	}
 12092  func (u betaToolResultBlockParamContentUnionSource) AsAny() any { return u.any }
 12093  
 12094  // Returns a pointer to the underlying variant's property, if present.
 12095  func (u betaToolResultBlockParamContentUnionSource) GetContent() *BetaContentBlockSourceContentUnionParam {
 12096  	switch vt := u.any.(type) {
 12097  	case *BetaRequestDocumentBlockSourceUnionParam:
 12098  		return vt.GetContent()
 12099  	}
 12100  	return nil
 12101  }
 12102  
 12103  // Returns a pointer to the underlying variant's property, if present.
 12104  func (u betaToolResultBlockParamContentUnionSource) GetData() *string {
 12105  	switch vt := u.any.(type) {
 12106  	case *BetaImageBlockParamSourceUnion:
 12107  		return vt.GetData()
 12108  	case *BetaRequestDocumentBlockSourceUnionParam:
 12109  		return vt.GetData()
 12110  	}
 12111  	return nil
 12112  }
 12113  
 12114  // Returns a pointer to the underlying variant's property, if present.
 12115  func (u betaToolResultBlockParamContentUnionSource) GetMediaType() *string {
 12116  	switch vt := u.any.(type) {
 12117  	case *BetaImageBlockParamSourceUnion:
 12118  		return vt.GetMediaType()
 12119  	case *BetaRequestDocumentBlockSourceUnionParam:
 12120  		return vt.GetMediaType()
 12121  	}
 12122  	return nil
 12123  }
 12124  
 12125  // Returns a pointer to the underlying variant's property, if present.
 12126  func (u betaToolResultBlockParamContentUnionSource) GetType() *string {
 12127  	switch vt := u.any.(type) {
 12128  	case *BetaImageBlockParamSourceUnion:
 12129  		return vt.GetType()
 12130  	case *BetaRequestDocumentBlockSourceUnionParam:
 12131  		return vt.GetType()
 12132  	}
 12133  	return nil
 12134  }
 12135  
 12136  // Returns a pointer to the underlying variant's property, if present.
 12137  func (u betaToolResultBlockParamContentUnionSource) GetURL() *string {
 12138  	switch vt := u.any.(type) {
 12139  	case *BetaImageBlockParamSourceUnion:
 12140  		return vt.GetURL()
 12141  	case *BetaRequestDocumentBlockSourceUnionParam:
 12142  		return vt.GetURL()
 12143  	}
 12144  	return nil
 12145  }
 12146  
 12147  // Returns a pointer to the underlying variant's property, if present.
 12148  func (u betaToolResultBlockParamContentUnionSource) GetFileID() *string {
 12149  	switch vt := u.any.(type) {
 12150  	case *BetaImageBlockParamSourceUnion:
 12151  		return vt.GetFileID()
 12152  	case *BetaRequestDocumentBlockSourceUnionParam:
 12153  		return vt.GetFileID()
 12154  	}
 12155  	return nil
 12156  }
 12157  
 12158  func init() {
 12159  	apijson.RegisterUnion[BetaToolResultBlockParamContentUnion](
 12160  		"type",
 12161  		apijson.Discriminator[BetaTextBlockParam]("text"),
 12162  		apijson.Discriminator[BetaImageBlockParam]("image"),
 12163  		apijson.Discriminator[BetaSearchResultBlockParam]("search_result"),
 12164  		apijson.Discriminator[BetaRequestDocumentBlockParam]("document"),
 12165  		apijson.Discriminator[BetaToolReferenceBlockParam]("tool_reference"),
 12166  		apijson.Discriminator[BetaBrowserStateBlockParam]("browser_state"),
 12167  	)
 12168  }
 12169  
 12170  // The properties Name, Type are required.
 12171  type BetaToolSearchToolBm25_20251119Param struct {
 12172  	// Any of "tool_search_tool_bm25_20251119", "tool_search_tool_bm25".
 12173  	Type BetaToolSearchToolBm25_20251119Type `json:"type,omitzero" api:"required"`
 12174  	// If true, tool will not be included in initial system prompt. Only loaded when
 12175  	// returned via tool_reference from tool search.
 12176  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 12177  	// When true, guarantees schema validation on tool names and inputs
 12178  	Strict param.Opt[bool] `json:"strict,omitzero"`
 12179  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 12180  	// "code_execution_20260521".
 12181  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 12182  	// Create a cache control breakpoint at this content block.
 12183  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 12184  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 12185  	// Name of the tool.
 12186  	//
 12187  	// This is how the tool will be called by the model and in `tool_use` blocks.
 12188  	//
 12189  	// This field can be elided, and will marshal its zero value as
 12190  	// "tool_search_tool_bm25".
 12191  	Name constant.ToolSearchToolBm25 `json:"name" default:"tool_search_tool_bm25"`
 12192  	paramObj
 12193  }
 12194  
 12195  func (r BetaToolSearchToolBm25_20251119Param) MarshalJSON() (data []byte, err error) {
 12196  	type shadow BetaToolSearchToolBm25_20251119Param
 12197  	return param.MarshalObject(r, (*shadow)(&r))
 12198  }
 12199  func (r *BetaToolSearchToolBm25_20251119Param) UnmarshalJSON(data []byte) error {
 12200  	return apijson.UnmarshalRoot(data, r)
 12201  }
 12202  
 12203  type BetaToolSearchToolBm25_20251119Type string
 12204  
 12205  const (
 12206  	BetaToolSearchToolBm25_20251119TypeToolSearchToolBm25_20251119 BetaToolSearchToolBm25_20251119Type = "tool_search_tool_bm25_20251119"
 12207  	BetaToolSearchToolBm25_20251119TypeToolSearchToolBm25          BetaToolSearchToolBm25_20251119Type = "tool_search_tool_bm25"
 12208  )
 12209  
 12210  // The properties Name, Type are required.
 12211  type BetaToolSearchToolRegex20251119Param struct {
 12212  	// Any of "tool_search_tool_regex_20251119", "tool_search_tool_regex".
 12213  	Type BetaToolSearchToolRegex20251119Type `json:"type,omitzero" api:"required"`
 12214  	// If true, tool will not be included in initial system prompt. Only loaded when
 12215  	// returned via tool_reference from tool search.
 12216  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 12217  	// When true, guarantees schema validation on tool names and inputs
 12218  	Strict param.Opt[bool] `json:"strict,omitzero"`
 12219  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 12220  	// "code_execution_20260521".
 12221  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 12222  	// Create a cache control breakpoint at this content block.
 12223  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 12224  	// Name of the tool.
 12225  	//
 12226  	// This is how the tool will be called by the model and in `tool_use` blocks.
 12227  	//
 12228  	// This field can be elided, and will marshal its zero value as
 12229  	// "tool_search_tool_regex".
 12230  	Name constant.ToolSearchToolRegex `json:"name" default:"tool_search_tool_regex"`
 12231  	paramObj
 12232  }
 12233  
 12234  func (r BetaToolSearchToolRegex20251119Param) MarshalJSON() (data []byte, err error) {
 12235  	type shadow BetaToolSearchToolRegex20251119Param
 12236  	return param.MarshalObject(r, (*shadow)(&r))
 12237  }
 12238  func (r *BetaToolSearchToolRegex20251119Param) UnmarshalJSON(data []byte) error {
 12239  	return apijson.UnmarshalRoot(data, r)
 12240  }
 12241  
 12242  type BetaToolSearchToolRegex20251119Type string
 12243  
 12244  const (
 12245  	BetaToolSearchToolRegex20251119TypeToolSearchToolRegex20251119 BetaToolSearchToolRegex20251119Type = "tool_search_tool_regex_20251119"
 12246  	BetaToolSearchToolRegex20251119TypeToolSearchToolRegex         BetaToolSearchToolRegex20251119Type = "tool_search_tool_regex"
 12247  )
 12248  
 12249  type BetaToolSearchToolResultBlock struct {
 12250  	Content   BetaToolSearchToolResultBlockContentUnion `json:"content" api:"required"`
 12251  	ToolUseID string                                    `json:"tool_use_id" api:"required"`
 12252  	Type      constant.ToolSearchToolResult             `json:"type" default:"tool_search_tool_result"`
 12253  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 12254  	JSON struct {
 12255  		Content     respjson.Field
 12256  		ToolUseID   respjson.Field
 12257  		Type        respjson.Field
 12258  		ExtraFields map[string]respjson.Field
 12259  		raw         string
 12260  	} `json:"-"`
 12261  }
 12262  
 12263  // Returns the unmodified JSON received from the API
 12264  func (r BetaToolSearchToolResultBlock) RawJSON() string { return r.JSON.raw }
 12265  func (r *BetaToolSearchToolResultBlock) UnmarshalJSON(data []byte) error {
 12266  	return apijson.UnmarshalRoot(data, r)
 12267  }
 12268  
 12269  // BetaToolSearchToolResultBlockContentUnion contains all possible properties and
 12270  // values from [BetaToolSearchToolResultError],
 12271  // [BetaToolSearchToolSearchResultBlock].
 12272  //
 12273  // Use the methods beginning with 'As' to cast the union to one of its variants.
 12274  type BetaToolSearchToolResultBlockContentUnion struct {
 12275  	// This field is from variant [BetaToolSearchToolResultError].
 12276  	ErrorCode BetaToolSearchToolResultErrorErrorCode `json:"error_code"`
 12277  	// This field is from variant [BetaToolSearchToolResultError].
 12278  	ErrorMessage string `json:"error_message"`
 12279  	Type         string `json:"type"`
 12280  	// This field is from variant [BetaToolSearchToolSearchResultBlock].
 12281  	ToolReferences []BetaToolReferenceBlock `json:"tool_references"`
 12282  	JSON           struct {
 12283  		ErrorCode      respjson.Field
 12284  		ErrorMessage   respjson.Field
 12285  		Type           respjson.Field
 12286  		ToolReferences respjson.Field
 12287  		raw            string
 12288  	} `json:"-"`
 12289  }
 12290  
 12291  func (u BetaToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolResultError() (v BetaToolSearchToolResultError) {
 12292  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 12293  	return
 12294  }
 12295  
 12296  func (u BetaToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolSearchResultBlock() (v BetaToolSearchToolSearchResultBlock) {
 12297  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 12298  	return
 12299  }
 12300  
 12301  // Returns the unmodified JSON received from the API
 12302  func (u BetaToolSearchToolResultBlockContentUnion) RawJSON() string { return u.JSON.raw }
 12303  
 12304  func (r *BetaToolSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error {
 12305  	return apijson.UnmarshalRoot(data, r)
 12306  }
 12307  
 12308  // The properties Content, ToolUseID, Type are required.
 12309  type BetaToolSearchToolResultBlockParam struct {
 12310  	Content   BetaToolSearchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
 12311  	ToolUseID string                                         `json:"tool_use_id" api:"required"`
 12312  	// Create a cache control breakpoint at this content block.
 12313  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 12314  	// This field can be elided, and will marshal its zero value as
 12315  	// "tool_search_tool_result".
 12316  	Type constant.ToolSearchToolResult `json:"type" default:"tool_search_tool_result"`
 12317  	paramObj
 12318  }
 12319  
 12320  func (r BetaToolSearchToolResultBlockParam) MarshalJSON() (data []byte, err error) {
 12321  	type shadow BetaToolSearchToolResultBlockParam
 12322  	return param.MarshalObject(r, (*shadow)(&r))
 12323  }
 12324  func (r *BetaToolSearchToolResultBlockParam) UnmarshalJSON(data []byte) error {
 12325  	return apijson.UnmarshalRoot(data, r)
 12326  }
 12327  
 12328  // Only one field can be non-zero.
 12329  //
 12330  // Use [param.IsOmitted] to confirm if a field is set.
 12331  type BetaToolSearchToolResultBlockParamContentUnion struct {
 12332  	OfRequestToolSearchToolResultError       *BetaToolSearchToolResultErrorParam       `json:",omitzero,inline"`
 12333  	OfRequestToolSearchToolSearchResultBlock *BetaToolSearchToolSearchResultBlockParam `json:",omitzero,inline"`
 12334  	paramUnion
 12335  }
 12336  
 12337  func (u BetaToolSearchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
 12338  	return param.MarshalUnion(u, u.OfRequestToolSearchToolResultError, u.OfRequestToolSearchToolSearchResultBlock)
 12339  }
 12340  func (u *BetaToolSearchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
 12341  	return apijson.UnmarshalRoot(data, u)
 12342  }
 12343  
 12344  func (u *BetaToolSearchToolResultBlockParamContentUnion) asAny() any {
 12345  	if !param.IsOmitted(u.OfRequestToolSearchToolResultError) {
 12346  		return u.OfRequestToolSearchToolResultError
 12347  	} else if !param.IsOmitted(u.OfRequestToolSearchToolSearchResultBlock) {
 12348  		return u.OfRequestToolSearchToolSearchResultBlock
 12349  	}
 12350  	return nil
 12351  }
 12352  
 12353  // Returns a pointer to the underlying variant's property, if present.
 12354  func (u BetaToolSearchToolResultBlockParamContentUnion) GetErrorCode() *string {
 12355  	if vt := u.OfRequestToolSearchToolResultError; vt != nil {
 12356  		return (*string)(&vt.ErrorCode)
 12357  	}
 12358  	return nil
 12359  }
 12360  
 12361  // Returns a pointer to the underlying variant's property, if present.
 12362  func (u BetaToolSearchToolResultBlockParamContentUnion) GetErrorMessage() *string {
 12363  	if vt := u.OfRequestToolSearchToolResultError; vt != nil && vt.ErrorMessage.Valid() {
 12364  		return &vt.ErrorMessage.Value
 12365  	}
 12366  	return nil
 12367  }
 12368  
 12369  // Returns a pointer to the underlying variant's property, if present.
 12370  func (u BetaToolSearchToolResultBlockParamContentUnion) GetToolReferences() []BetaToolReferenceBlockParam {
 12371  	if vt := u.OfRequestToolSearchToolSearchResultBlock; vt != nil {
 12372  		return vt.ToolReferences
 12373  	}
 12374  	return nil
 12375  }
 12376  
 12377  // Returns a pointer to the underlying variant's property, if present.
 12378  func (u BetaToolSearchToolResultBlockParamContentUnion) GetType() *string {
 12379  	if vt := u.OfRequestToolSearchToolResultError; vt != nil {
 12380  		return (*string)(&vt.Type)
 12381  	} else if vt := u.OfRequestToolSearchToolSearchResultBlock; vt != nil {
 12382  		return (*string)(&vt.Type)
 12383  	}
 12384  	return nil
 12385  }
 12386  
 12387  type BetaToolSearchToolResultError struct {
 12388  	// Any of "invalid_tool_input", "unavailable", "too_many_requests",
 12389  	// "execution_time_exceeded".
 12390  	ErrorCode    BetaToolSearchToolResultErrorErrorCode `json:"error_code" api:"required"`
 12391  	ErrorMessage string                                 `json:"error_message" api:"required"`
 12392  	Type         constant.ToolSearchToolResultError     `json:"type" default:"tool_search_tool_result_error"`
 12393  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 12394  	JSON struct {
 12395  		ErrorCode    respjson.Field
 12396  		ErrorMessage respjson.Field
 12397  		Type         respjson.Field
 12398  		ExtraFields  map[string]respjson.Field
 12399  		raw          string
 12400  	} `json:"-"`
 12401  }
 12402  
 12403  // Returns the unmodified JSON received from the API
 12404  func (r BetaToolSearchToolResultError) RawJSON() string { return r.JSON.raw }
 12405  func (r *BetaToolSearchToolResultError) UnmarshalJSON(data []byte) error {
 12406  	return apijson.UnmarshalRoot(data, r)
 12407  }
 12408  
 12409  type BetaToolSearchToolResultErrorErrorCode string
 12410  
 12411  const (
 12412  	BetaToolSearchToolResultErrorErrorCodeInvalidToolInput      BetaToolSearchToolResultErrorErrorCode = "invalid_tool_input"
 12413  	BetaToolSearchToolResultErrorErrorCodeUnavailable           BetaToolSearchToolResultErrorErrorCode = "unavailable"
 12414  	BetaToolSearchToolResultErrorErrorCodeTooManyRequests       BetaToolSearchToolResultErrorErrorCode = "too_many_requests"
 12415  	BetaToolSearchToolResultErrorErrorCodeExecutionTimeExceeded BetaToolSearchToolResultErrorErrorCode = "execution_time_exceeded"
 12416  )
 12417  
 12418  // The properties ErrorCode, Type are required.
 12419  type BetaToolSearchToolResultErrorParam struct {
 12420  	// Any of "invalid_tool_input", "unavailable", "too_many_requests",
 12421  	// "execution_time_exceeded".
 12422  	ErrorCode    BetaToolSearchToolResultErrorParamErrorCode `json:"error_code,omitzero" api:"required"`
 12423  	ErrorMessage param.Opt[string]                           `json:"error_message,omitzero"`
 12424  	// This field can be elided, and will marshal its zero value as
 12425  	// "tool_search_tool_result_error".
 12426  	Type constant.ToolSearchToolResultError `json:"type" default:"tool_search_tool_result_error"`
 12427  	paramObj
 12428  }
 12429  
 12430  func (r BetaToolSearchToolResultErrorParam) MarshalJSON() (data []byte, err error) {
 12431  	type shadow BetaToolSearchToolResultErrorParam
 12432  	return param.MarshalObject(r, (*shadow)(&r))
 12433  }
 12434  func (r *BetaToolSearchToolResultErrorParam) UnmarshalJSON(data []byte) error {
 12435  	return apijson.UnmarshalRoot(data, r)
 12436  }
 12437  
 12438  type BetaToolSearchToolResultErrorParamErrorCode string
 12439  
 12440  const (
 12441  	BetaToolSearchToolResultErrorParamErrorCodeInvalidToolInput      BetaToolSearchToolResultErrorParamErrorCode = "invalid_tool_input"
 12442  	BetaToolSearchToolResultErrorParamErrorCodeUnavailable           BetaToolSearchToolResultErrorParamErrorCode = "unavailable"
 12443  	BetaToolSearchToolResultErrorParamErrorCodeTooManyRequests       BetaToolSearchToolResultErrorParamErrorCode = "too_many_requests"
 12444  	BetaToolSearchToolResultErrorParamErrorCodeExecutionTimeExceeded BetaToolSearchToolResultErrorParamErrorCode = "execution_time_exceeded"
 12445  )
 12446  
 12447  type BetaToolSearchToolSearchResultBlock struct {
 12448  	ToolReferences []BetaToolReferenceBlock            `json:"tool_references" api:"required"`
 12449  	Type           constant.ToolSearchToolSearchResult `json:"type" default:"tool_search_tool_search_result"`
 12450  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 12451  	JSON struct {
 12452  		ToolReferences respjson.Field
 12453  		Type           respjson.Field
 12454  		ExtraFields    map[string]respjson.Field
 12455  		raw            string
 12456  	} `json:"-"`
 12457  }
 12458  
 12459  // Returns the unmodified JSON received from the API
 12460  func (r BetaToolSearchToolSearchResultBlock) RawJSON() string { return r.JSON.raw }
 12461  func (r *BetaToolSearchToolSearchResultBlock) UnmarshalJSON(data []byte) error {
 12462  	return apijson.UnmarshalRoot(data, r)
 12463  }
 12464  
 12465  // The properties ToolReferences, Type are required.
 12466  type BetaToolSearchToolSearchResultBlockParam struct {
 12467  	ToolReferences []BetaToolReferenceBlockParam `json:"tool_references,omitzero" api:"required"`
 12468  	// This field can be elided, and will marshal its zero value as
 12469  	// "tool_search_tool_search_result".
 12470  	Type constant.ToolSearchToolSearchResult `json:"type" default:"tool_search_tool_search_result"`
 12471  	paramObj
 12472  }
 12473  
 12474  func (r BetaToolSearchToolSearchResultBlockParam) MarshalJSON() (data []byte, err error) {
 12475  	type shadow BetaToolSearchToolSearchResultBlockParam
 12476  	return param.MarshalObject(r, (*shadow)(&r))
 12477  }
 12478  func (r *BetaToolSearchToolSearchResultBlockParam) UnmarshalJSON(data []byte) error {
 12479  	return apijson.UnmarshalRoot(data, r)
 12480  }
 12481  
 12482  // The properties Name, Type are required.
 12483  type BetaToolTextEditor20241022Param struct {
 12484  	// If true, tool will not be included in initial system prompt. Only loaded when
 12485  	// returned via tool_reference from tool search.
 12486  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 12487  	// When true, guarantees schema validation on tool names and inputs
 12488  	Strict param.Opt[bool] `json:"strict,omitzero"`
 12489  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 12490  	// "code_execution_20260521".
 12491  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 12492  	// Create a cache control breakpoint at this content block.
 12493  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 12494  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 12495  	// Name of the tool.
 12496  	//
 12497  	// This is how the tool will be called by the model and in `tool_use` blocks.
 12498  	//
 12499  	// This field can be elided, and will marshal its zero value as
 12500  	// "str_replace_editor".
 12501  	Name constant.StrReplaceEditor `json:"name" default:"str_replace_editor"`
 12502  	// This field can be elided, and will marshal its zero value as
 12503  	// "text_editor_20241022".
 12504  	Type constant.TextEditor20241022 `json:"type" default:"text_editor_20241022"`
 12505  	paramObj
 12506  }
 12507  
 12508  func (r BetaToolTextEditor20241022Param) MarshalJSON() (data []byte, err error) {
 12509  	type shadow BetaToolTextEditor20241022Param
 12510  	return param.MarshalObject(r, (*shadow)(&r))
 12511  }
 12512  func (r *BetaToolTextEditor20241022Param) UnmarshalJSON(data []byte) error {
 12513  	return apijson.UnmarshalRoot(data, r)
 12514  }
 12515  
 12516  // The properties Name, Type are required.
 12517  type BetaToolTextEditor20250124Param struct {
 12518  	// If true, tool will not be included in initial system prompt. Only loaded when
 12519  	// returned via tool_reference from tool search.
 12520  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 12521  	// When true, guarantees schema validation on tool names and inputs
 12522  	Strict param.Opt[bool] `json:"strict,omitzero"`
 12523  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 12524  	// "code_execution_20260521".
 12525  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 12526  	// Create a cache control breakpoint at this content block.
 12527  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 12528  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 12529  	// Name of the tool.
 12530  	//
 12531  	// This is how the tool will be called by the model and in `tool_use` blocks.
 12532  	//
 12533  	// This field can be elided, and will marshal its zero value as
 12534  	// "str_replace_editor".
 12535  	Name constant.StrReplaceEditor `json:"name" default:"str_replace_editor"`
 12536  	// This field can be elided, and will marshal its zero value as
 12537  	// "text_editor_20250124".
 12538  	Type constant.TextEditor20250124 `json:"type" default:"text_editor_20250124"`
 12539  	paramObj
 12540  }
 12541  
 12542  func (r BetaToolTextEditor20250124Param) MarshalJSON() (data []byte, err error) {
 12543  	type shadow BetaToolTextEditor20250124Param
 12544  	return param.MarshalObject(r, (*shadow)(&r))
 12545  }
 12546  func (r *BetaToolTextEditor20250124Param) UnmarshalJSON(data []byte) error {
 12547  	return apijson.UnmarshalRoot(data, r)
 12548  }
 12549  
 12550  // The properties Name, Type are required.
 12551  type BetaToolTextEditor20250429Param struct {
 12552  	// If true, tool will not be included in initial system prompt. Only loaded when
 12553  	// returned via tool_reference from tool search.
 12554  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 12555  	// When true, guarantees schema validation on tool names and inputs
 12556  	Strict param.Opt[bool] `json:"strict,omitzero"`
 12557  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 12558  	// "code_execution_20260521".
 12559  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 12560  	// Create a cache control breakpoint at this content block.
 12561  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 12562  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 12563  	// Name of the tool.
 12564  	//
 12565  	// This is how the tool will be called by the model and in `tool_use` blocks.
 12566  	//
 12567  	// This field can be elided, and will marshal its zero value as
 12568  	// "str_replace_based_edit_tool".
 12569  	Name constant.StrReplaceBasedEditTool `json:"name" default:"str_replace_based_edit_tool"`
 12570  	// This field can be elided, and will marshal its zero value as
 12571  	// "text_editor_20250429".
 12572  	Type constant.TextEditor20250429 `json:"type" default:"text_editor_20250429"`
 12573  	paramObj
 12574  }
 12575  
 12576  func (r BetaToolTextEditor20250429Param) MarshalJSON() (data []byte, err error) {
 12577  	type shadow BetaToolTextEditor20250429Param
 12578  	return param.MarshalObject(r, (*shadow)(&r))
 12579  }
 12580  func (r *BetaToolTextEditor20250429Param) UnmarshalJSON(data []byte) error {
 12581  	return apijson.UnmarshalRoot(data, r)
 12582  }
 12583  
 12584  // The properties Name, Type are required.
 12585  type BetaToolTextEditor20250728Param struct {
 12586  	// Maximum number of characters to display when viewing a file. If not specified,
 12587  	// defaults to displaying the full file.
 12588  	MaxCharacters param.Opt[int64] `json:"max_characters,omitzero"`
 12589  	// If true, tool will not be included in initial system prompt. Only loaded when
 12590  	// returned via tool_reference from tool search.
 12591  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 12592  	// When true, guarantees schema validation on tool names and inputs
 12593  	Strict param.Opt[bool] `json:"strict,omitzero"`
 12594  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 12595  	// "code_execution_20260521".
 12596  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 12597  	// Create a cache control breakpoint at this content block.
 12598  	CacheControl  BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 12599  	InputExamples []map[string]any               `json:"input_examples,omitzero"`
 12600  	// Name of the tool.
 12601  	//
 12602  	// This is how the tool will be called by the model and in `tool_use` blocks.
 12603  	//
 12604  	// This field can be elided, and will marshal its zero value as
 12605  	// "str_replace_based_edit_tool".
 12606  	Name constant.StrReplaceBasedEditTool `json:"name" default:"str_replace_based_edit_tool"`
 12607  	// This field can be elided, and will marshal its zero value as
 12608  	// "text_editor_20250728".
 12609  	Type constant.TextEditor20250728 `json:"type" default:"text_editor_20250728"`
 12610  	paramObj
 12611  }
 12612  
 12613  func (r BetaToolTextEditor20250728Param) MarshalJSON() (data []byte, err error) {
 12614  	type shadow BetaToolTextEditor20250728Param
 12615  	return param.MarshalObject(r, (*shadow)(&r))
 12616  }
 12617  func (r *BetaToolTextEditor20250728Param) UnmarshalJSON(data []byte) error {
 12618  	return apijson.UnmarshalRoot(data, r)
 12619  }
 12620  
 12621  func BetaToolUnionParamOfTool(inputSchema BetaToolInputSchemaParam, name string) BetaToolUnionParam {
 12622  	var variant BetaToolParam
 12623  	variant.InputSchema = inputSchema
 12624  	variant.Name = name
 12625  	return BetaToolUnionParam{OfTool: &variant}
 12626  }
 12627  
 12628  func BetaToolUnionParamOfComputerUseTool20241022(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam {
 12629  	var variant BetaToolComputerUse20241022Param
 12630  	variant.DisplayHeightPx = displayHeightPx
 12631  	variant.DisplayWidthPx = displayWidthPx
 12632  	return BetaToolUnionParam{OfComputerUseTool20241022: &variant}
 12633  }
 12634  
 12635  func BetaToolUnionParamOfComputerUseTool20250124(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam {
 12636  	var variant BetaToolComputerUse20250124Param
 12637  	variant.DisplayHeightPx = displayHeightPx
 12638  	variant.DisplayWidthPx = displayWidthPx
 12639  	return BetaToolUnionParam{OfComputerUseTool20250124: &variant}
 12640  }
 12641  
 12642  func BetaToolUnionParamOfComputerUseTool20251124(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam {
 12643  	var variant BetaToolComputerUse20251124Param
 12644  	variant.DisplayHeightPx = displayHeightPx
 12645  	variant.DisplayWidthPx = displayWidthPx
 12646  	return BetaToolUnionParam{OfComputerUseTool20251124: &variant}
 12647  }
 12648  
 12649  func BetaToolUnionParamOfAdvisorTool20260301(model Model) BetaToolUnionParam {
 12650  	var variant BetaAdvisorTool20260301Param
 12651  	variant.Model = model
 12652  	return BetaToolUnionParam{OfAdvisorTool20260301: &variant}
 12653  }
 12654  
 12655  func BetaToolUnionParamOfToolSearchToolBm25_20251119(type_ BetaToolSearchToolBm25_20251119Type) BetaToolUnionParam {
 12656  	var variant BetaToolSearchToolBm25_20251119Param
 12657  	variant.Type = type_
 12658  	return BetaToolUnionParam{OfToolSearchToolBm25_20251119: &variant}
 12659  }
 12660  
 12661  func BetaToolUnionParamOfToolSearchToolRegex20251119(type_ BetaToolSearchToolRegex20251119Type) BetaToolUnionParam {
 12662  	var variant BetaToolSearchToolRegex20251119Param
 12663  	variant.Type = type_
 12664  	return BetaToolUnionParam{OfToolSearchToolRegex20251119: &variant}
 12665  }
 12666  
 12667  func BetaToolUnionParamOfMCPToolset(mcpServerName string) BetaToolUnionParam {
 12668  	var variant BetaMCPToolsetParam
 12669  	variant.MCPServerName = mcpServerName
 12670  	return BetaToolUnionParam{OfMCPToolset: &variant}
 12671  }
 12672  
 12673  // Only one field can be non-zero.
 12674  //
 12675  // Use [param.IsOmitted] to confirm if a field is set.
 12676  type BetaToolUnionParam struct {
 12677  	OfTool                        *BetaToolParam                        `json:",omitzero,inline"`
 12678  	OfBashTool20241022            *BetaToolBash20241022Param            `json:",omitzero,inline"`
 12679  	OfBashTool20250124            *BetaToolBash20250124Param            `json:",omitzero,inline"`
 12680  	OfCodeExecutionTool20250522   *BetaCodeExecutionTool20250522Param   `json:",omitzero,inline"`
 12681  	OfCodeExecutionTool20250825   *BetaCodeExecutionTool20250825Param   `json:",omitzero,inline"`
 12682  	OfCodeExecutionTool20260120   *BetaCodeExecutionTool20260120Param   `json:",omitzero,inline"`
 12683  	OfCodeExecutionTool20260521   *BetaCodeExecutionTool20260521Param   `json:",omitzero,inline"`
 12684  	OfBrowserToolset20260801      *BetaBrowserToolset20260801Param      `json:",omitzero,inline"`
 12685  	OfComputerUseTool20241022     *BetaToolComputerUse20241022Param     `json:",omitzero,inline"`
 12686  	OfMemoryTool20250818          *BetaMemoryTool20250818Param          `json:",omitzero,inline"`
 12687  	OfComputerUseTool20250124     *BetaToolComputerUse20250124Param     `json:",omitzero,inline"`
 12688  	OfTextEditor20241022          *BetaToolTextEditor20241022Param      `json:",omitzero,inline"`
 12689  	OfComputerUseTool20251124     *BetaToolComputerUse20251124Param     `json:",omitzero,inline"`
 12690  	OfComputerToolset20260801     *BetaComputerToolset20260801Param     `json:",omitzero,inline"`
 12691  	OfTextEditor20250124          *BetaToolTextEditor20250124Param      `json:",omitzero,inline"`
 12692  	OfTextEditor20250429          *BetaToolTextEditor20250429Param      `json:",omitzero,inline"`
 12693  	OfTextEditor20250728          *BetaToolTextEditor20250728Param      `json:",omitzero,inline"`
 12694  	OfWebSearchTool20250305       *BetaWebSearchTool20250305Param       `json:",omitzero,inline"`
 12695  	OfWebFetchTool20250910        *BetaWebFetchTool20250910Param        `json:",omitzero,inline"`
 12696  	OfWebSearchTool20260209       *BetaWebSearchTool20260209Param       `json:",omitzero,inline"`
 12697  	OfWebFetchTool20260209        *BetaWebFetchTool20260209Param        `json:",omitzero,inline"`
 12698  	OfWebFetchTool20260309        *BetaWebFetchTool20260309Param        `json:",omitzero,inline"`
 12699  	OfWebSearchTool20260318       *BetaWebSearchTool20260318Param       `json:",omitzero,inline"`
 12700  	OfWebFetchTool20260318        *BetaWebFetchTool20260318Param        `json:",omitzero,inline"`
 12701  	OfAdvisorTool20260301         *BetaAdvisorTool20260301Param         `json:",omitzero,inline"`
 12702  	OfToolSearchToolBm25_20251119 *BetaToolSearchToolBm25_20251119Param `json:",omitzero,inline"`
 12703  	OfToolSearchToolRegex20251119 *BetaToolSearchToolRegex20251119Param `json:",omitzero,inline"`
 12704  	OfMCPToolset                  *BetaMCPToolsetParam                  `json:",omitzero,inline"`
 12705  	paramUnion
 12706  }
 12707  
 12708  func (u BetaToolUnionParam) MarshalJSON() ([]byte, error) {
 12709  	return param.MarshalUnion(u, u.OfTool,
 12710  		u.OfBashTool20241022,
 12711  		u.OfBashTool20250124,
 12712  		u.OfCodeExecutionTool20250522,
 12713  		u.OfCodeExecutionTool20250825,
 12714  		u.OfCodeExecutionTool20260120,
 12715  		u.OfCodeExecutionTool20260521,
 12716  		u.OfBrowserToolset20260801,
 12717  		u.OfComputerUseTool20241022,
 12718  		u.OfMemoryTool20250818,
 12719  		u.OfComputerUseTool20250124,
 12720  		u.OfTextEditor20241022,
 12721  		u.OfComputerUseTool20251124,
 12722  		u.OfComputerToolset20260801,
 12723  		u.OfTextEditor20250124,
 12724  		u.OfTextEditor20250429,
 12725  		u.OfTextEditor20250728,
 12726  		u.OfWebSearchTool20250305,
 12727  		u.OfWebFetchTool20250910,
 12728  		u.OfWebSearchTool20260209,
 12729  		u.OfWebFetchTool20260209,
 12730  		u.OfWebFetchTool20260309,
 12731  		u.OfWebSearchTool20260318,
 12732  		u.OfWebFetchTool20260318,
 12733  		u.OfAdvisorTool20260301,
 12734  		u.OfToolSearchToolBm25_20251119,
 12735  		u.OfToolSearchToolRegex20251119,
 12736  		u.OfMCPToolset)
 12737  }
 12738  func (u *BetaToolUnionParam) UnmarshalJSON(data []byte) error {
 12739  	return apijson.UnmarshalRoot(data, u)
 12740  }
 12741  
 12742  func (u *BetaToolUnionParam) asAny() any {
 12743  	if !param.IsOmitted(u.OfTool) {
 12744  		return u.OfTool
 12745  	} else if !param.IsOmitted(u.OfBashTool20241022) {
 12746  		return u.OfBashTool20241022
 12747  	} else if !param.IsOmitted(u.OfBashTool20250124) {
 12748  		return u.OfBashTool20250124
 12749  	} else if !param.IsOmitted(u.OfCodeExecutionTool20250522) {
 12750  		return u.OfCodeExecutionTool20250522
 12751  	} else if !param.IsOmitted(u.OfCodeExecutionTool20250825) {
 12752  		return u.OfCodeExecutionTool20250825
 12753  	} else if !param.IsOmitted(u.OfCodeExecutionTool20260120) {
 12754  		return u.OfCodeExecutionTool20260120
 12755  	} else if !param.IsOmitted(u.OfCodeExecutionTool20260521) {
 12756  		return u.OfCodeExecutionTool20260521
 12757  	} else if !param.IsOmitted(u.OfBrowserToolset20260801) {
 12758  		return u.OfBrowserToolset20260801
 12759  	} else if !param.IsOmitted(u.OfComputerUseTool20241022) {
 12760  		return u.OfComputerUseTool20241022
 12761  	} else if !param.IsOmitted(u.OfMemoryTool20250818) {
 12762  		return u.OfMemoryTool20250818
 12763  	} else if !param.IsOmitted(u.OfComputerUseTool20250124) {
 12764  		return u.OfComputerUseTool20250124
 12765  	} else if !param.IsOmitted(u.OfTextEditor20241022) {
 12766  		return u.OfTextEditor20241022
 12767  	} else if !param.IsOmitted(u.OfComputerUseTool20251124) {
 12768  		return u.OfComputerUseTool20251124
 12769  	} else if !param.IsOmitted(u.OfComputerToolset20260801) {
 12770  		return u.OfComputerToolset20260801
 12771  	} else if !param.IsOmitted(u.OfTextEditor20250124) {
 12772  		return u.OfTextEditor20250124
 12773  	} else if !param.IsOmitted(u.OfTextEditor20250429) {
 12774  		return u.OfTextEditor20250429
 12775  	} else if !param.IsOmitted(u.OfTextEditor20250728) {
 12776  		return u.OfTextEditor20250728
 12777  	} else if !param.IsOmitted(u.OfWebSearchTool20250305) {
 12778  		return u.OfWebSearchTool20250305
 12779  	} else if !param.IsOmitted(u.OfWebFetchTool20250910) {
 12780  		return u.OfWebFetchTool20250910
 12781  	} else if !param.IsOmitted(u.OfWebSearchTool20260209) {
 12782  		return u.OfWebSearchTool20260209
 12783  	} else if !param.IsOmitted(u.OfWebFetchTool20260209) {
 12784  		return u.OfWebFetchTool20260209
 12785  	} else if !param.IsOmitted(u.OfWebFetchTool20260309) {
 12786  		return u.OfWebFetchTool20260309
 12787  	} else if !param.IsOmitted(u.OfWebSearchTool20260318) {
 12788  		return u.OfWebSearchTool20260318
 12789  	} else if !param.IsOmitted(u.OfWebFetchTool20260318) {
 12790  		return u.OfWebFetchTool20260318
 12791  	} else if !param.IsOmitted(u.OfAdvisorTool20260301) {
 12792  		return u.OfAdvisorTool20260301
 12793  	} else if !param.IsOmitted(u.OfToolSearchToolBm25_20251119) {
 12794  		return u.OfToolSearchToolBm25_20251119
 12795  	} else if !param.IsOmitted(u.OfToolSearchToolRegex20251119) {
 12796  		return u.OfToolSearchToolRegex20251119
 12797  	} else if !param.IsOmitted(u.OfMCPToolset) {
 12798  		return u.OfMCPToolset
 12799  	}
 12800  	return nil
 12801  }
 12802  
 12803  // Returns a pointer to the underlying variant's property, if present.
 12804  func (u BetaToolUnionParam) GetInputSchema() *BetaToolInputSchemaParam {
 12805  	if vt := u.OfTool; vt != nil {
 12806  		return &vt.InputSchema
 12807  	}
 12808  	return nil
 12809  }
 12810  
 12811  // Returns a pointer to the underlying variant's property, if present.
 12812  func (u BetaToolUnionParam) GetDescription() *string {
 12813  	if vt := u.OfTool; vt != nil && vt.Description.Valid() {
 12814  		return &vt.Description.Value
 12815  	}
 12816  	return nil
 12817  }
 12818  
 12819  // Returns a pointer to the underlying variant's property, if present.
 12820  func (u BetaToolUnionParam) GetEagerInputStreaming() *bool {
 12821  	if vt := u.OfTool; vt != nil && vt.EagerInputStreaming.Valid() {
 12822  		return &vt.EagerInputStreaming.Value
 12823  	}
 12824  	return nil
 12825  }
 12826  
 12827  // Returns a pointer to the underlying variant's property, if present.
 12828  func (u BetaToolUnionParam) GetEnableZoom() *bool {
 12829  	if vt := u.OfComputerUseTool20251124; vt != nil && vt.EnableZoom.Valid() {
 12830  		return &vt.EnableZoom.Value
 12831  	}
 12832  	return nil
 12833  }
 12834  
 12835  // Returns a pointer to the underlying variant's property, if present.
 12836  func (u BetaToolUnionParam) GetMaxCharacters() *int64 {
 12837  	if vt := u.OfTextEditor20250728; vt != nil && vt.MaxCharacters.Valid() {
 12838  		return &vt.MaxCharacters.Value
 12839  	}
 12840  	return nil
 12841  }
 12842  
 12843  // Returns a pointer to the underlying variant's property, if present.
 12844  func (u BetaToolUnionParam) GetModel() *Model {
 12845  	if vt := u.OfAdvisorTool20260301; vt != nil {
 12846  		return &vt.Model
 12847  	}
 12848  	return nil
 12849  }
 12850  
 12851  // Returns a pointer to the underlying variant's property, if present.
 12852  func (u BetaToolUnionParam) GetCaching() *BetaCacheControlEphemeralParam {
 12853  	if vt := u.OfAdvisorTool20260301; vt != nil {
 12854  		return &vt.Caching
 12855  	}
 12856  	return nil
 12857  }
 12858  
 12859  // Returns a pointer to the underlying variant's property, if present.
 12860  func (u BetaToolUnionParam) GetMaxTokens() *int64 {
 12861  	if vt := u.OfAdvisorTool20260301; vt != nil && vt.MaxTokens.Valid() {
 12862  		return &vt.MaxTokens.Value
 12863  	}
 12864  	return nil
 12865  }
 12866  
 12867  // Returns a pointer to the underlying variant's property, if present.
 12868  func (u BetaToolUnionParam) GetMCPServerName() *string {
 12869  	if vt := u.OfMCPToolset; vt != nil {
 12870  		return &vt.MCPServerName
 12871  	}
 12872  	return nil
 12873  }
 12874  
 12875  // Returns a pointer to the underlying variant's property, if present.
 12876  func (u BetaToolUnionParam) GetDefaultConfig() *BetaMCPToolDefaultConfigParam {
 12877  	if vt := u.OfMCPToolset; vt != nil {
 12878  		return &vt.DefaultConfig
 12879  	}
 12880  	return nil
 12881  }
 12882  
 12883  // Returns a pointer to the underlying variant's property, if present.
 12884  func (u BetaToolUnionParam) GetName() *string {
 12885  	if vt := u.OfTool; vt != nil {
 12886  		return (*string)(&vt.Name)
 12887  	} else if vt := u.OfBashTool20241022; vt != nil {
 12888  		return (*string)(&vt.Name)
 12889  	} else if vt := u.OfBashTool20250124; vt != nil {
 12890  		return (*string)(&vt.Name)
 12891  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil {
 12892  		return (*string)(&vt.Name)
 12893  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil {
 12894  		return (*string)(&vt.Name)
 12895  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil {
 12896  		return (*string)(&vt.Name)
 12897  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil {
 12898  		return (*string)(&vt.Name)
 12899  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 12900  		return (*string)(&vt.Name)
 12901  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 12902  		return (*string)(&vt.Name)
 12903  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 12904  		return (*string)(&vt.Name)
 12905  	} else if vt := u.OfTextEditor20241022; vt != nil {
 12906  		return (*string)(&vt.Name)
 12907  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 12908  		return (*string)(&vt.Name)
 12909  	} else if vt := u.OfTextEditor20250124; vt != nil {
 12910  		return (*string)(&vt.Name)
 12911  	} else if vt := u.OfTextEditor20250429; vt != nil {
 12912  		return (*string)(&vt.Name)
 12913  	} else if vt := u.OfTextEditor20250728; vt != nil {
 12914  		return (*string)(&vt.Name)
 12915  	} else if vt := u.OfWebSearchTool20250305; vt != nil {
 12916  		return (*string)(&vt.Name)
 12917  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 12918  		return (*string)(&vt.Name)
 12919  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 12920  		return (*string)(&vt.Name)
 12921  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 12922  		return (*string)(&vt.Name)
 12923  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 12924  		return (*string)(&vt.Name)
 12925  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 12926  		return (*string)(&vt.Name)
 12927  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 12928  		return (*string)(&vt.Name)
 12929  	} else if vt := u.OfAdvisorTool20260301; vt != nil {
 12930  		return (*string)(&vt.Name)
 12931  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil {
 12932  		return (*string)(&vt.Name)
 12933  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil {
 12934  		return (*string)(&vt.Name)
 12935  	}
 12936  	return nil
 12937  }
 12938  
 12939  // Returns a pointer to the underlying variant's property, if present.
 12940  func (u BetaToolUnionParam) GetDeferLoading() *bool {
 12941  	if vt := u.OfTool; vt != nil && vt.DeferLoading.Valid() {
 12942  		return &vt.DeferLoading.Value
 12943  	} else if vt := u.OfBashTool20241022; vt != nil && vt.DeferLoading.Valid() {
 12944  		return &vt.DeferLoading.Value
 12945  	} else if vt := u.OfBashTool20250124; vt != nil && vt.DeferLoading.Valid() {
 12946  		return &vt.DeferLoading.Value
 12947  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil && vt.DeferLoading.Valid() {
 12948  		return &vt.DeferLoading.Value
 12949  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil && vt.DeferLoading.Valid() {
 12950  		return &vt.DeferLoading.Value
 12951  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil && vt.DeferLoading.Valid() {
 12952  		return &vt.DeferLoading.Value
 12953  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil && vt.DeferLoading.Valid() {
 12954  		return &vt.DeferLoading.Value
 12955  	} else if vt := u.OfComputerUseTool20241022; vt != nil && vt.DeferLoading.Valid() {
 12956  		return &vt.DeferLoading.Value
 12957  	} else if vt := u.OfMemoryTool20250818; vt != nil && vt.DeferLoading.Valid() {
 12958  		return &vt.DeferLoading.Value
 12959  	} else if vt := u.OfComputerUseTool20250124; vt != nil && vt.DeferLoading.Valid() {
 12960  		return &vt.DeferLoading.Value
 12961  	} else if vt := u.OfTextEditor20241022; vt != nil && vt.DeferLoading.Valid() {
 12962  		return &vt.DeferLoading.Value
 12963  	} else if vt := u.OfComputerUseTool20251124; vt != nil && vt.DeferLoading.Valid() {
 12964  		return &vt.DeferLoading.Value
 12965  	} else if vt := u.OfTextEditor20250124; vt != nil && vt.DeferLoading.Valid() {
 12966  		return &vt.DeferLoading.Value
 12967  	} else if vt := u.OfTextEditor20250429; vt != nil && vt.DeferLoading.Valid() {
 12968  		return &vt.DeferLoading.Value
 12969  	} else if vt := u.OfTextEditor20250728; vt != nil && vt.DeferLoading.Valid() {
 12970  		return &vt.DeferLoading.Value
 12971  	} else if vt := u.OfWebSearchTool20250305; vt != nil && vt.DeferLoading.Valid() {
 12972  		return &vt.DeferLoading.Value
 12973  	} else if vt := u.OfWebFetchTool20250910; vt != nil && vt.DeferLoading.Valid() {
 12974  		return &vt.DeferLoading.Value
 12975  	} else if vt := u.OfWebSearchTool20260209; vt != nil && vt.DeferLoading.Valid() {
 12976  		return &vt.DeferLoading.Value
 12977  	} else if vt := u.OfWebFetchTool20260209; vt != nil && vt.DeferLoading.Valid() {
 12978  		return &vt.DeferLoading.Value
 12979  	} else if vt := u.OfWebFetchTool20260309; vt != nil && vt.DeferLoading.Valid() {
 12980  		return &vt.DeferLoading.Value
 12981  	} else if vt := u.OfWebSearchTool20260318; vt != nil && vt.DeferLoading.Valid() {
 12982  		return &vt.DeferLoading.Value
 12983  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.DeferLoading.Valid() {
 12984  		return &vt.DeferLoading.Value
 12985  	} else if vt := u.OfAdvisorTool20260301; vt != nil && vt.DeferLoading.Valid() {
 12986  		return &vt.DeferLoading.Value
 12987  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil && vt.DeferLoading.Valid() {
 12988  		return &vt.DeferLoading.Value
 12989  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil && vt.DeferLoading.Valid() {
 12990  		return &vt.DeferLoading.Value
 12991  	}
 12992  	return nil
 12993  }
 12994  
 12995  // Returns a pointer to the underlying variant's property, if present.
 12996  func (u BetaToolUnionParam) GetStrict() *bool {
 12997  	if vt := u.OfTool; vt != nil && vt.Strict.Valid() {
 12998  		return &vt.Strict.Value
 12999  	} else if vt := u.OfBashTool20241022; vt != nil && vt.Strict.Valid() {
 13000  		return &vt.Strict.Value
 13001  	} else if vt := u.OfBashTool20250124; vt != nil && vt.Strict.Valid() {
 13002  		return &vt.Strict.Value
 13003  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil && vt.Strict.Valid() {
 13004  		return &vt.Strict.Value
 13005  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil && vt.Strict.Valid() {
 13006  		return &vt.Strict.Value
 13007  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil && vt.Strict.Valid() {
 13008  		return &vt.Strict.Value
 13009  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil && vt.Strict.Valid() {
 13010  		return &vt.Strict.Value
 13011  	} else if vt := u.OfComputerUseTool20241022; vt != nil && vt.Strict.Valid() {
 13012  		return &vt.Strict.Value
 13013  	} else if vt := u.OfMemoryTool20250818; vt != nil && vt.Strict.Valid() {
 13014  		return &vt.Strict.Value
 13015  	} else if vt := u.OfComputerUseTool20250124; vt != nil && vt.Strict.Valid() {
 13016  		return &vt.Strict.Value
 13017  	} else if vt := u.OfTextEditor20241022; vt != nil && vt.Strict.Valid() {
 13018  		return &vt.Strict.Value
 13019  	} else if vt := u.OfComputerUseTool20251124; vt != nil && vt.Strict.Valid() {
 13020  		return &vt.Strict.Value
 13021  	} else if vt := u.OfTextEditor20250124; vt != nil && vt.Strict.Valid() {
 13022  		return &vt.Strict.Value
 13023  	} else if vt := u.OfTextEditor20250429; vt != nil && vt.Strict.Valid() {
 13024  		return &vt.Strict.Value
 13025  	} else if vt := u.OfTextEditor20250728; vt != nil && vt.Strict.Valid() {
 13026  		return &vt.Strict.Value
 13027  	} else if vt := u.OfWebSearchTool20250305; vt != nil && vt.Strict.Valid() {
 13028  		return &vt.Strict.Value
 13029  	} else if vt := u.OfWebFetchTool20250910; vt != nil && vt.Strict.Valid() {
 13030  		return &vt.Strict.Value
 13031  	} else if vt := u.OfWebSearchTool20260209; vt != nil && vt.Strict.Valid() {
 13032  		return &vt.Strict.Value
 13033  	} else if vt := u.OfWebFetchTool20260209; vt != nil && vt.Strict.Valid() {
 13034  		return &vt.Strict.Value
 13035  	} else if vt := u.OfWebFetchTool20260309; vt != nil && vt.Strict.Valid() {
 13036  		return &vt.Strict.Value
 13037  	} else if vt := u.OfWebSearchTool20260318; vt != nil && vt.Strict.Valid() {
 13038  		return &vt.Strict.Value
 13039  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.Strict.Valid() {
 13040  		return &vt.Strict.Value
 13041  	} else if vt := u.OfAdvisorTool20260301; vt != nil && vt.Strict.Valid() {
 13042  		return &vt.Strict.Value
 13043  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil && vt.Strict.Valid() {
 13044  		return &vt.Strict.Value
 13045  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil && vt.Strict.Valid() {
 13046  		return &vt.Strict.Value
 13047  	}
 13048  	return nil
 13049  }
 13050  
 13051  // Returns a pointer to the underlying variant's property, if present.
 13052  func (u BetaToolUnionParam) GetType() *string {
 13053  	if vt := u.OfTool; vt != nil {
 13054  		return (*string)(&vt.Type)
 13055  	} else if vt := u.OfBashTool20241022; vt != nil {
 13056  		return (*string)(&vt.Type)
 13057  	} else if vt := u.OfBashTool20250124; vt != nil {
 13058  		return (*string)(&vt.Type)
 13059  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil {
 13060  		return (*string)(&vt.Type)
 13061  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil {
 13062  		return (*string)(&vt.Type)
 13063  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil {
 13064  		return (*string)(&vt.Type)
 13065  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil {
 13066  		return (*string)(&vt.Type)
 13067  	} else if vt := u.OfBrowserToolset20260801; vt != nil {
 13068  		return (*string)(&vt.Type)
 13069  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 13070  		return (*string)(&vt.Type)
 13071  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 13072  		return (*string)(&vt.Type)
 13073  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 13074  		return (*string)(&vt.Type)
 13075  	} else if vt := u.OfTextEditor20241022; vt != nil {
 13076  		return (*string)(&vt.Type)
 13077  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 13078  		return (*string)(&vt.Type)
 13079  	} else if vt := u.OfComputerToolset20260801; vt != nil {
 13080  		return (*string)(&vt.Type)
 13081  	} else if vt := u.OfTextEditor20250124; vt != nil {
 13082  		return (*string)(&vt.Type)
 13083  	} else if vt := u.OfTextEditor20250429; vt != nil {
 13084  		return (*string)(&vt.Type)
 13085  	} else if vt := u.OfTextEditor20250728; vt != nil {
 13086  		return (*string)(&vt.Type)
 13087  	} else if vt := u.OfWebSearchTool20250305; vt != nil {
 13088  		return (*string)(&vt.Type)
 13089  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 13090  		return (*string)(&vt.Type)
 13091  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 13092  		return (*string)(&vt.Type)
 13093  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 13094  		return (*string)(&vt.Type)
 13095  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 13096  		return (*string)(&vt.Type)
 13097  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 13098  		return (*string)(&vt.Type)
 13099  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 13100  		return (*string)(&vt.Type)
 13101  	} else if vt := u.OfAdvisorTool20260301; vt != nil {
 13102  		return (*string)(&vt.Type)
 13103  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil {
 13104  		return (*string)(&vt.Type)
 13105  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil {
 13106  		return (*string)(&vt.Type)
 13107  	} else if vt := u.OfMCPToolset; vt != nil {
 13108  		return (*string)(&vt.Type)
 13109  	}
 13110  	return nil
 13111  }
 13112  
 13113  // Returns a pointer to the underlying variant's property, if present.
 13114  func (u BetaToolUnionParam) GetDisplayHeightPx() *int64 {
 13115  	if vt := u.OfComputerUseTool20241022; vt != nil {
 13116  		return (*int64)(&vt.DisplayHeightPx)
 13117  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 13118  		return (*int64)(&vt.DisplayHeightPx)
 13119  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 13120  		return (*int64)(&vt.DisplayHeightPx)
 13121  	}
 13122  	return nil
 13123  }
 13124  
 13125  // Returns a pointer to the underlying variant's property, if present.
 13126  func (u BetaToolUnionParam) GetDisplayWidthPx() *int64 {
 13127  	if vt := u.OfComputerUseTool20241022; vt != nil {
 13128  		return (*int64)(&vt.DisplayWidthPx)
 13129  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 13130  		return (*int64)(&vt.DisplayWidthPx)
 13131  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 13132  		return (*int64)(&vt.DisplayWidthPx)
 13133  	}
 13134  	return nil
 13135  }
 13136  
 13137  // Returns a pointer to the underlying variant's property, if present.
 13138  func (u BetaToolUnionParam) GetDisplayNumber() *int64 {
 13139  	if vt := u.OfComputerUseTool20241022; vt != nil && vt.DisplayNumber.Valid() {
 13140  		return &vt.DisplayNumber.Value
 13141  	} else if vt := u.OfComputerUseTool20250124; vt != nil && vt.DisplayNumber.Valid() {
 13142  		return &vt.DisplayNumber.Value
 13143  	} else if vt := u.OfComputerUseTool20251124; vt != nil && vt.DisplayNumber.Valid() {
 13144  		return &vt.DisplayNumber.Value
 13145  	}
 13146  	return nil
 13147  }
 13148  
 13149  // Returns a pointer to the underlying variant's property, if present.
 13150  func (u BetaToolUnionParam) GetMaxUses() *int64 {
 13151  	if vt := u.OfWebSearchTool20250305; vt != nil && vt.MaxUses.Valid() {
 13152  		return &vt.MaxUses.Value
 13153  	} else if vt := u.OfWebFetchTool20250910; vt != nil && vt.MaxUses.Valid() {
 13154  		return &vt.MaxUses.Value
 13155  	} else if vt := u.OfWebSearchTool20260209; vt != nil && vt.MaxUses.Valid() {
 13156  		return &vt.MaxUses.Value
 13157  	} else if vt := u.OfWebFetchTool20260209; vt != nil && vt.MaxUses.Valid() {
 13158  		return &vt.MaxUses.Value
 13159  	} else if vt := u.OfWebFetchTool20260309; vt != nil && vt.MaxUses.Valid() {
 13160  		return &vt.MaxUses.Value
 13161  	} else if vt := u.OfWebSearchTool20260318; vt != nil && vt.MaxUses.Valid() {
 13162  		return &vt.MaxUses.Value
 13163  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.MaxUses.Valid() {
 13164  		return &vt.MaxUses.Value
 13165  	} else if vt := u.OfAdvisorTool20260301; vt != nil && vt.MaxUses.Valid() {
 13166  		return &vt.MaxUses.Value
 13167  	}
 13168  	return nil
 13169  }
 13170  
 13171  // Returns a pointer to the underlying variant's property, if present.
 13172  func (u BetaToolUnionParam) GetMaxContentTokens() *int64 {
 13173  	if vt := u.OfWebFetchTool20250910; vt != nil && vt.MaxContentTokens.Valid() {
 13174  		return &vt.MaxContentTokens.Value
 13175  	} else if vt := u.OfWebFetchTool20260209; vt != nil && vt.MaxContentTokens.Valid() {
 13176  		return &vt.MaxContentTokens.Value
 13177  	} else if vt := u.OfWebFetchTool20260309; vt != nil && vt.MaxContentTokens.Valid() {
 13178  		return &vt.MaxContentTokens.Value
 13179  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.MaxContentTokens.Valid() {
 13180  		return &vt.MaxContentTokens.Value
 13181  	}
 13182  	return nil
 13183  }
 13184  
 13185  // Returns a pointer to the underlying variant's property, if present.
 13186  func (u BetaToolUnionParam) GetUseCache() *bool {
 13187  	if vt := u.OfWebFetchTool20260309; vt != nil && vt.UseCache.Valid() {
 13188  		return &vt.UseCache.Value
 13189  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.UseCache.Valid() {
 13190  		return &vt.UseCache.Value
 13191  	}
 13192  	return nil
 13193  }
 13194  
 13195  // Returns a pointer to the underlying variant's property, if present.
 13196  func (u BetaToolUnionParam) GetResponseInclusion() *string {
 13197  	if vt := u.OfWebSearchTool20260318; vt != nil {
 13198  		return (*string)(&vt.ResponseInclusion)
 13199  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 13200  		return (*string)(&vt.ResponseInclusion)
 13201  	}
 13202  	return nil
 13203  }
 13204  
 13205  // Returns a pointer to the underlying variant's AllowedCallers property, if
 13206  // present.
 13207  func (u BetaToolUnionParam) GetAllowedCallers() []string {
 13208  	if vt := u.OfTool; vt != nil {
 13209  		return vt.AllowedCallers
 13210  	} else if vt := u.OfBashTool20241022; vt != nil {
 13211  		return vt.AllowedCallers
 13212  	} else if vt := u.OfBashTool20250124; vt != nil {
 13213  		return vt.AllowedCallers
 13214  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil {
 13215  		return vt.AllowedCallers
 13216  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil {
 13217  		return vt.AllowedCallers
 13218  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil {
 13219  		return vt.AllowedCallers
 13220  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil {
 13221  		return vt.AllowedCallers
 13222  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 13223  		return vt.AllowedCallers
 13224  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 13225  		return vt.AllowedCallers
 13226  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 13227  		return vt.AllowedCallers
 13228  	} else if vt := u.OfTextEditor20241022; vt != nil {
 13229  		return vt.AllowedCallers
 13230  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 13231  		return vt.AllowedCallers
 13232  	} else if vt := u.OfTextEditor20250124; vt != nil {
 13233  		return vt.AllowedCallers
 13234  	} else if vt := u.OfTextEditor20250429; vt != nil {
 13235  		return vt.AllowedCallers
 13236  	} else if vt := u.OfTextEditor20250728; vt != nil {
 13237  		return vt.AllowedCallers
 13238  	} else if vt := u.OfWebSearchTool20250305; vt != nil {
 13239  		return vt.AllowedCallers
 13240  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 13241  		return vt.AllowedCallers
 13242  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 13243  		return vt.AllowedCallers
 13244  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 13245  		return vt.AllowedCallers
 13246  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 13247  		return vt.AllowedCallers
 13248  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 13249  		return vt.AllowedCallers
 13250  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 13251  		return vt.AllowedCallers
 13252  	} else if vt := u.OfAdvisorTool20260301; vt != nil {
 13253  		return vt.AllowedCallers
 13254  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil {
 13255  		return vt.AllowedCallers
 13256  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil {
 13257  		return vt.AllowedCallers
 13258  	}
 13259  	return nil
 13260  }
 13261  
 13262  // Returns a pointer to the underlying variant's CacheControl property, if present.
 13263  func (u BetaToolUnionParam) GetCacheControl() *BetaCacheControlEphemeralParam {
 13264  	if vt := u.OfTool; vt != nil {
 13265  		return &vt.CacheControl
 13266  	} else if vt := u.OfBashTool20241022; vt != nil {
 13267  		return &vt.CacheControl
 13268  	} else if vt := u.OfBashTool20250124; vt != nil {
 13269  		return &vt.CacheControl
 13270  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil {
 13271  		return &vt.CacheControl
 13272  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil {
 13273  		return &vt.CacheControl
 13274  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil {
 13275  		return &vt.CacheControl
 13276  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil {
 13277  		return &vt.CacheControl
 13278  	} else if vt := u.OfBrowserToolset20260801; vt != nil {
 13279  		return &vt.CacheControl
 13280  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 13281  		return &vt.CacheControl
 13282  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 13283  		return &vt.CacheControl
 13284  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 13285  		return &vt.CacheControl
 13286  	} else if vt := u.OfTextEditor20241022; vt != nil {
 13287  		return &vt.CacheControl
 13288  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 13289  		return &vt.CacheControl
 13290  	} else if vt := u.OfComputerToolset20260801; vt != nil {
 13291  		return &vt.CacheControl
 13292  	} else if vt := u.OfTextEditor20250124; vt != nil {
 13293  		return &vt.CacheControl
 13294  	} else if vt := u.OfTextEditor20250429; vt != nil {
 13295  		return &vt.CacheControl
 13296  	} else if vt := u.OfTextEditor20250728; vt != nil {
 13297  		return &vt.CacheControl
 13298  	} else if vt := u.OfWebSearchTool20250305; vt != nil {
 13299  		return &vt.CacheControl
 13300  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 13301  		return &vt.CacheControl
 13302  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 13303  		return &vt.CacheControl
 13304  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 13305  		return &vt.CacheControl
 13306  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 13307  		return &vt.CacheControl
 13308  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 13309  		return &vt.CacheControl
 13310  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 13311  		return &vt.CacheControl
 13312  	} else if vt := u.OfAdvisorTool20260301; vt != nil {
 13313  		return &vt.CacheControl
 13314  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil {
 13315  		return &vt.CacheControl
 13316  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil {
 13317  		return &vt.CacheControl
 13318  	} else if vt := u.OfMCPToolset; vt != nil {
 13319  		return &vt.CacheControl
 13320  	}
 13321  	return nil
 13322  }
 13323  
 13324  // Returns a pointer to the underlying variant's InputExamples property, if
 13325  // present.
 13326  func (u BetaToolUnionParam) GetInputExamples() []map[string]any {
 13327  	if vt := u.OfTool; vt != nil {
 13328  		return vt.InputExamples
 13329  	} else if vt := u.OfBashTool20241022; vt != nil {
 13330  		return vt.InputExamples
 13331  	} else if vt := u.OfBashTool20250124; vt != nil {
 13332  		return vt.InputExamples
 13333  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 13334  		return vt.InputExamples
 13335  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 13336  		return vt.InputExamples
 13337  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 13338  		return vt.InputExamples
 13339  	} else if vt := u.OfTextEditor20241022; vt != nil {
 13340  		return vt.InputExamples
 13341  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 13342  		return vt.InputExamples
 13343  	} else if vt := u.OfTextEditor20250124; vt != nil {
 13344  		return vt.InputExamples
 13345  	} else if vt := u.OfTextEditor20250429; vt != nil {
 13346  		return vt.InputExamples
 13347  	} else if vt := u.OfTextEditor20250728; vt != nil {
 13348  		return vt.InputExamples
 13349  	}
 13350  	return nil
 13351  }
 13352  
 13353  // Returns a subunion which exports methods to access subproperties
 13354  //
 13355  // Or use AsAny() to get the underlying value
 13356  func (u BetaToolUnionParam) GetConfigs() (res betaToolUnionParamConfigs) {
 13357  	if vt := u.OfBrowserToolset20260801; vt != nil {
 13358  		res.any = &vt.Configs
 13359  	} else if vt := u.OfComputerToolset20260801; vt != nil {
 13360  		res.any = &vt.Configs
 13361  	} else if vt := u.OfMCPToolset; vt != nil {
 13362  		res.any = &vt.Configs
 13363  	}
 13364  	return
 13365  }
 13366  
 13367  // Can have the runtime types [*BetaBrowserToolsetConfigsParam],
 13368  // [*BetaComputerToolsetConfigsParam], [\*map[string]BetaMCPToolConfigParam]
 13369  type betaToolUnionParamConfigs struct{ any }
 13370  
 13371  // Use the following switch statement to get the type of the union:
 13372  //
 13373  //	switch u.AsAny().(type) {
 13374  //	case *anthropic.BetaBrowserToolsetConfigsParam:
 13375  //	case *anthropic.BetaComputerToolsetConfigsParam:
 13376  //	case *map[string]anthropic.BetaMCPToolConfigParam:
 13377  //	default:
 13378  //	    fmt.Errorf("not present")
 13379  //	}
 13380  func (u betaToolUnionParamConfigs) AsAny() any { return u.any }
 13381  
 13382  // Returns a pointer to the underlying variant's property, if present.
 13383  func (u betaToolUnionParamConfigs) GetCloseTab() *BetaBrowserCloseTabConfigParam {
 13384  	switch vt := u.any.(type) {
 13385  	case *BetaBrowserToolsetConfigsParam:
 13386  		return &vt.CloseTab
 13387  	}
 13388  	return nil
 13389  }
 13390  
 13391  // Returns a pointer to the underlying variant's property, if present.
 13392  func (u betaToolUnionParamConfigs) GetFileUpload() *BetaBrowserFileUploadConfigParam {
 13393  	switch vt := u.any.(type) {
 13394  	case *BetaBrowserToolsetConfigsParam:
 13395  		return &vt.FileUpload
 13396  	}
 13397  	return nil
 13398  }
 13399  
 13400  // Returns a pointer to the underlying variant's property, if present.
 13401  func (u betaToolUnionParamConfigs) GetFind() *BetaBrowserFindConfigParam {
 13402  	switch vt := u.any.(type) {
 13403  	case *BetaBrowserToolsetConfigsParam:
 13404  		return &vt.Find
 13405  	}
 13406  	return nil
 13407  }
 13408  
 13409  // Returns a pointer to the underlying variant's property, if present.
 13410  func (u betaToolUnionParamConfigs) GetFormInput() *BetaBrowserFormInputConfigParam {
 13411  	switch vt := u.any.(type) {
 13412  	case *BetaBrowserToolsetConfigsParam:
 13413  		return &vt.FormInput
 13414  	}
 13415  	return nil
 13416  }
 13417  
 13418  // Returns a pointer to the underlying variant's property, if present.
 13419  func (u betaToolUnionParamConfigs) GetGetPageText() *BetaBrowserGetPageTextConfigParam {
 13420  	switch vt := u.any.(type) {
 13421  	case *BetaBrowserToolsetConfigsParam:
 13422  		return &vt.GetPageText
 13423  	}
 13424  	return nil
 13425  }
 13426  
 13427  // Returns a pointer to the underlying variant's property, if present.
 13428  func (u betaToolUnionParamConfigs) GetHover() *BetaBrowserHoverConfigParam {
 13429  	switch vt := u.any.(type) {
 13430  	case *BetaBrowserToolsetConfigsParam:
 13431  		return &vt.Hover
 13432  	}
 13433  	return nil
 13434  }
 13435  
 13436  // Returns a pointer to the underlying variant's property, if present.
 13437  func (u betaToolUnionParamConfigs) GetJavascriptExec() *BetaBrowserJavascriptExecConfigParam {
 13438  	switch vt := u.any.(type) {
 13439  	case *BetaBrowserToolsetConfigsParam:
 13440  		return &vt.JavascriptExec
 13441  	}
 13442  	return nil
 13443  }
 13444  
 13445  // Returns a pointer to the underlying variant's property, if present.
 13446  func (u betaToolUnionParamConfigs) GetListTabs() *BetaBrowserListTabsConfigParam {
 13447  	switch vt := u.any.(type) {
 13448  	case *BetaBrowserToolsetConfigsParam:
 13449  		return &vt.ListTabs
 13450  	}
 13451  	return nil
 13452  }
 13453  
 13454  // Returns a pointer to the underlying variant's property, if present.
 13455  func (u betaToolUnionParamConfigs) GetNavigate() *BetaBrowserNavigateConfigParam {
 13456  	switch vt := u.any.(type) {
 13457  	case *BetaBrowserToolsetConfigsParam:
 13458  		return &vt.Navigate
 13459  	}
 13460  	return nil
 13461  }
 13462  
 13463  // Returns a pointer to the underlying variant's property, if present.
 13464  func (u betaToolUnionParamConfigs) GetNewTab() *BetaBrowserNewTabConfigParam {
 13465  	switch vt := u.any.(type) {
 13466  	case *BetaBrowserToolsetConfigsParam:
 13467  		return &vt.NewTab
 13468  	}
 13469  	return nil
 13470  }
 13471  
 13472  // Returns a pointer to the underlying variant's property, if present.
 13473  func (u betaToolUnionParamConfigs) GetReadConsole() *BetaBrowserReadConsoleConfigParam {
 13474  	switch vt := u.any.(type) {
 13475  	case *BetaBrowserToolsetConfigsParam:
 13476  		return &vt.ReadConsole
 13477  	}
 13478  	return nil
 13479  }
 13480  
 13481  // Returns a pointer to the underlying variant's property, if present.
 13482  func (u betaToolUnionParamConfigs) GetReadNetwork() *BetaBrowserReadNetworkConfigParam {
 13483  	switch vt := u.any.(type) {
 13484  	case *BetaBrowserToolsetConfigsParam:
 13485  		return &vt.ReadNetwork
 13486  	}
 13487  	return nil
 13488  }
 13489  
 13490  // Returns a pointer to the underlying variant's property, if present.
 13491  func (u betaToolUnionParamConfigs) GetReadPage() *BetaBrowserReadPageConfigParam {
 13492  	switch vt := u.any.(type) {
 13493  	case *BetaBrowserToolsetConfigsParam:
 13494  		return &vt.ReadPage
 13495  	}
 13496  	return nil
 13497  }
 13498  
 13499  // Returns a pointer to the underlying variant's property, if present.
 13500  func (u betaToolUnionParamConfigs) GetScrollTo() *BetaBrowserScrollToConfigParam {
 13501  	switch vt := u.any.(type) {
 13502  	case *BetaBrowserToolsetConfigsParam:
 13503  		return &vt.ScrollTo
 13504  	}
 13505  	return nil
 13506  }
 13507  
 13508  // Returns a pointer to the underlying variant's property, if present.
 13509  func (u betaToolUnionParamConfigs) GetSwitchTab() *BetaBrowserSwitchTabConfigParam {
 13510  	switch vt := u.any.(type) {
 13511  	case *BetaBrowserToolsetConfigsParam:
 13512  		return &vt.SwitchTab
 13513  	}
 13514  	return nil
 13515  }
 13516  
 13517  // Returns a pointer to the underlying variant's property, if present.
 13518  func (u betaToolUnionParamConfigs) GetCursorPosition() *BetaComputerCursorPositionConfigParam {
 13519  	switch vt := u.any.(type) {
 13520  	case *BetaComputerToolsetConfigsParam:
 13521  		return &vt.CursorPosition
 13522  	}
 13523  	return nil
 13524  }
 13525  
 13526  // Returns a subunion which exports methods to access subproperties
 13527  //
 13528  // Or use AsAny() to get the underlying value
 13529  func (u betaToolUnionParamConfigs) GetDoubleClick() (res betaToolUnionParamConfigsDoubleClick) {
 13530  	switch vt := u.any.(type) {
 13531  	case *BetaBrowserToolsetConfigsParam:
 13532  		res.any = &vt.DoubleClick
 13533  	case *BetaComputerToolsetConfigsParam:
 13534  		res.any = &vt.DoubleClick
 13535  	}
 13536  	return res
 13537  }
 13538  
 13539  // Can have the runtime types [*BetaBrowserDoubleClickConfigParam],
 13540  // [*BetaComputerDoubleClickConfigParam]
 13541  type betaToolUnionParamConfigsDoubleClick struct{ any }
 13542  
 13543  // Use the following switch statement to get the type of the union:
 13544  //
 13545  //	switch u.AsAny().(type) {
 13546  //	case *anthropic.BetaBrowserDoubleClickConfigParam:
 13547  //	case *anthropic.BetaComputerDoubleClickConfigParam:
 13548  //	default:
 13549  //	    fmt.Errorf("not present")
 13550  //	}
 13551  func (u betaToolUnionParamConfigsDoubleClick) AsAny() any { return u.any }
 13552  
 13553  // Returns a pointer to the underlying variant's property, if present.
 13554  func (u betaToolUnionParamConfigsDoubleClick) GetDeferLoading() *bool {
 13555  	switch vt := u.any.(type) {
 13556  	case *BetaBrowserDoubleClickConfigParam:
 13557  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13558  	case *BetaComputerDoubleClickConfigParam:
 13559  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13560  	}
 13561  	return nil
 13562  }
 13563  
 13564  // Returns a pointer to the underlying variant's property, if present.
 13565  func (u betaToolUnionParamConfigsDoubleClick) GetEnabled() *bool {
 13566  	switch vt := u.any.(type) {
 13567  	case *BetaBrowserDoubleClickConfigParam:
 13568  		return paramutil.AddrIfPresent(vt.Enabled)
 13569  	case *BetaComputerDoubleClickConfigParam:
 13570  		return paramutil.AddrIfPresent(vt.Enabled)
 13571  	}
 13572  	return nil
 13573  }
 13574  
 13575  // Returns a subunion which exports methods to access subproperties
 13576  //
 13577  // Or use AsAny() to get the underlying value
 13578  func (u betaToolUnionParamConfigs) GetHoldKey() (res betaToolUnionParamConfigsHoldKey) {
 13579  	switch vt := u.any.(type) {
 13580  	case *BetaBrowserToolsetConfigsParam:
 13581  		res.any = &vt.HoldKey
 13582  	case *BetaComputerToolsetConfigsParam:
 13583  		res.any = &vt.HoldKey
 13584  	}
 13585  	return res
 13586  }
 13587  
 13588  // Can have the runtime types [*BetaBrowserHoldKeyConfigParam],
 13589  // [*BetaComputerHoldKeyConfigParam]
 13590  type betaToolUnionParamConfigsHoldKey struct{ any }
 13591  
 13592  // Use the following switch statement to get the type of the union:
 13593  //
 13594  //	switch u.AsAny().(type) {
 13595  //	case *anthropic.BetaBrowserHoldKeyConfigParam:
 13596  //	case *anthropic.BetaComputerHoldKeyConfigParam:
 13597  //	default:
 13598  //	    fmt.Errorf("not present")
 13599  //	}
 13600  func (u betaToolUnionParamConfigsHoldKey) AsAny() any { return u.any }
 13601  
 13602  // Returns a pointer to the underlying variant's property, if present.
 13603  func (u betaToolUnionParamConfigsHoldKey) GetDeferLoading() *bool {
 13604  	switch vt := u.any.(type) {
 13605  	case *BetaBrowserHoldKeyConfigParam:
 13606  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13607  	case *BetaComputerHoldKeyConfigParam:
 13608  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13609  	}
 13610  	return nil
 13611  }
 13612  
 13613  // Returns a pointer to the underlying variant's property, if present.
 13614  func (u betaToolUnionParamConfigsHoldKey) GetEnabled() *bool {
 13615  	switch vt := u.any.(type) {
 13616  	case *BetaBrowserHoldKeyConfigParam:
 13617  		return paramutil.AddrIfPresent(vt.Enabled)
 13618  	case *BetaComputerHoldKeyConfigParam:
 13619  		return paramutil.AddrIfPresent(vt.Enabled)
 13620  	}
 13621  	return nil
 13622  }
 13623  
 13624  // Returns a subunion which exports methods to access subproperties
 13625  //
 13626  // Or use AsAny() to get the underlying value
 13627  func (u betaToolUnionParamConfigs) GetKey() (res betaToolUnionParamConfigsKey) {
 13628  	switch vt := u.any.(type) {
 13629  	case *BetaBrowserToolsetConfigsParam:
 13630  		res.any = &vt.Key
 13631  	case *BetaComputerToolsetConfigsParam:
 13632  		res.any = &vt.Key
 13633  	}
 13634  	return res
 13635  }
 13636  
 13637  // Can have the runtime types [*BetaBrowserKeyConfigParam],
 13638  // [*BetaComputerKeyConfigParam]
 13639  type betaToolUnionParamConfigsKey struct{ any }
 13640  
 13641  // Use the following switch statement to get the type of the union:
 13642  //
 13643  //	switch u.AsAny().(type) {
 13644  //	case *anthropic.BetaBrowserKeyConfigParam:
 13645  //	case *anthropic.BetaComputerKeyConfigParam:
 13646  //	default:
 13647  //	    fmt.Errorf("not present")
 13648  //	}
 13649  func (u betaToolUnionParamConfigsKey) AsAny() any { return u.any }
 13650  
 13651  // Returns a pointer to the underlying variant's property, if present.
 13652  func (u betaToolUnionParamConfigsKey) GetDeferLoading() *bool {
 13653  	switch vt := u.any.(type) {
 13654  	case *BetaBrowserKeyConfigParam:
 13655  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13656  	case *BetaComputerKeyConfigParam:
 13657  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13658  	}
 13659  	return nil
 13660  }
 13661  
 13662  // Returns a pointer to the underlying variant's property, if present.
 13663  func (u betaToolUnionParamConfigsKey) GetEnabled() *bool {
 13664  	switch vt := u.any.(type) {
 13665  	case *BetaBrowserKeyConfigParam:
 13666  		return paramutil.AddrIfPresent(vt.Enabled)
 13667  	case *BetaComputerKeyConfigParam:
 13668  		return paramutil.AddrIfPresent(vt.Enabled)
 13669  	}
 13670  	return nil
 13671  }
 13672  
 13673  // Returns a subunion which exports methods to access subproperties
 13674  //
 13675  // Or use AsAny() to get the underlying value
 13676  func (u betaToolUnionParamConfigs) GetLeftClick() (res betaToolUnionParamConfigsLeftClick) {
 13677  	switch vt := u.any.(type) {
 13678  	case *BetaBrowserToolsetConfigsParam:
 13679  		res.any = &vt.LeftClick
 13680  	case *BetaComputerToolsetConfigsParam:
 13681  		res.any = &vt.LeftClick
 13682  	}
 13683  	return res
 13684  }
 13685  
 13686  // Can have the runtime types [*BetaBrowserLeftClickConfigParam],
 13687  // [*BetaComputerLeftClickConfigParam]
 13688  type betaToolUnionParamConfigsLeftClick struct{ any }
 13689  
 13690  // Use the following switch statement to get the type of the union:
 13691  //
 13692  //	switch u.AsAny().(type) {
 13693  //	case *anthropic.BetaBrowserLeftClickConfigParam:
 13694  //	case *anthropic.BetaComputerLeftClickConfigParam:
 13695  //	default:
 13696  //	    fmt.Errorf("not present")
 13697  //	}
 13698  func (u betaToolUnionParamConfigsLeftClick) AsAny() any { return u.any }
 13699  
 13700  // Returns a pointer to the underlying variant's property, if present.
 13701  func (u betaToolUnionParamConfigsLeftClick) GetDeferLoading() *bool {
 13702  	switch vt := u.any.(type) {
 13703  	case *BetaBrowserLeftClickConfigParam:
 13704  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13705  	case *BetaComputerLeftClickConfigParam:
 13706  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13707  	}
 13708  	return nil
 13709  }
 13710  
 13711  // Returns a pointer to the underlying variant's property, if present.
 13712  func (u betaToolUnionParamConfigsLeftClick) GetEnabled() *bool {
 13713  	switch vt := u.any.(type) {
 13714  	case *BetaBrowserLeftClickConfigParam:
 13715  		return paramutil.AddrIfPresent(vt.Enabled)
 13716  	case *BetaComputerLeftClickConfigParam:
 13717  		return paramutil.AddrIfPresent(vt.Enabled)
 13718  	}
 13719  	return nil
 13720  }
 13721  
 13722  // Returns a subunion which exports methods to access subproperties
 13723  //
 13724  // Or use AsAny() to get the underlying value
 13725  func (u betaToolUnionParamConfigs) GetLeftClickDrag() (res betaToolUnionParamConfigsLeftClickDrag) {
 13726  	switch vt := u.any.(type) {
 13727  	case *BetaBrowserToolsetConfigsParam:
 13728  		res.any = &vt.LeftClickDrag
 13729  	case *BetaComputerToolsetConfigsParam:
 13730  		res.any = &vt.LeftClickDrag
 13731  	}
 13732  	return res
 13733  }
 13734  
 13735  // Can have the runtime types [*BetaBrowserLeftClickDragConfigParam],
 13736  // [*BetaComputerLeftClickDragConfigParam]
 13737  type betaToolUnionParamConfigsLeftClickDrag struct{ any }
 13738  
 13739  // Use the following switch statement to get the type of the union:
 13740  //
 13741  //	switch u.AsAny().(type) {
 13742  //	case *anthropic.BetaBrowserLeftClickDragConfigParam:
 13743  //	case *anthropic.BetaComputerLeftClickDragConfigParam:
 13744  //	default:
 13745  //	    fmt.Errorf("not present")
 13746  //	}
 13747  func (u betaToolUnionParamConfigsLeftClickDrag) AsAny() any { return u.any }
 13748  
 13749  // Returns a pointer to the underlying variant's property, if present.
 13750  func (u betaToolUnionParamConfigsLeftClickDrag) GetDeferLoading() *bool {
 13751  	switch vt := u.any.(type) {
 13752  	case *BetaBrowserLeftClickDragConfigParam:
 13753  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13754  	case *BetaComputerLeftClickDragConfigParam:
 13755  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13756  	}
 13757  	return nil
 13758  }
 13759  
 13760  // Returns a pointer to the underlying variant's property, if present.
 13761  func (u betaToolUnionParamConfigsLeftClickDrag) GetEnabled() *bool {
 13762  	switch vt := u.any.(type) {
 13763  	case *BetaBrowserLeftClickDragConfigParam:
 13764  		return paramutil.AddrIfPresent(vt.Enabled)
 13765  	case *BetaComputerLeftClickDragConfigParam:
 13766  		return paramutil.AddrIfPresent(vt.Enabled)
 13767  	}
 13768  	return nil
 13769  }
 13770  
 13771  // Returns a subunion which exports methods to access subproperties
 13772  //
 13773  // Or use AsAny() to get the underlying value
 13774  func (u betaToolUnionParamConfigs) GetLeftMouseDown() (res betaToolUnionParamConfigsLeftMouseDown) {
 13775  	switch vt := u.any.(type) {
 13776  	case *BetaBrowserToolsetConfigsParam:
 13777  		res.any = &vt.LeftMouseDown
 13778  	case *BetaComputerToolsetConfigsParam:
 13779  		res.any = &vt.LeftMouseDown
 13780  	}
 13781  	return res
 13782  }
 13783  
 13784  // Can have the runtime types [*BetaBrowserLeftMouseDownConfigParam],
 13785  // [*BetaComputerLeftMouseDownConfigParam]
 13786  type betaToolUnionParamConfigsLeftMouseDown struct{ any }
 13787  
 13788  // Use the following switch statement to get the type of the union:
 13789  //
 13790  //	switch u.AsAny().(type) {
 13791  //	case *anthropic.BetaBrowserLeftMouseDownConfigParam:
 13792  //	case *anthropic.BetaComputerLeftMouseDownConfigParam:
 13793  //	default:
 13794  //	    fmt.Errorf("not present")
 13795  //	}
 13796  func (u betaToolUnionParamConfigsLeftMouseDown) AsAny() any { return u.any }
 13797  
 13798  // Returns a pointer to the underlying variant's property, if present.
 13799  func (u betaToolUnionParamConfigsLeftMouseDown) GetDeferLoading() *bool {
 13800  	switch vt := u.any.(type) {
 13801  	case *BetaBrowserLeftMouseDownConfigParam:
 13802  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13803  	case *BetaComputerLeftMouseDownConfigParam:
 13804  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13805  	}
 13806  	return nil
 13807  }
 13808  
 13809  // Returns a pointer to the underlying variant's property, if present.
 13810  func (u betaToolUnionParamConfigsLeftMouseDown) GetEnabled() *bool {
 13811  	switch vt := u.any.(type) {
 13812  	case *BetaBrowserLeftMouseDownConfigParam:
 13813  		return paramutil.AddrIfPresent(vt.Enabled)
 13814  	case *BetaComputerLeftMouseDownConfigParam:
 13815  		return paramutil.AddrIfPresent(vt.Enabled)
 13816  	}
 13817  	return nil
 13818  }
 13819  
 13820  // Returns a subunion which exports methods to access subproperties
 13821  //
 13822  // Or use AsAny() to get the underlying value
 13823  func (u betaToolUnionParamConfigs) GetLeftMouseUp() (res betaToolUnionParamConfigsLeftMouseUp) {
 13824  	switch vt := u.any.(type) {
 13825  	case *BetaBrowserToolsetConfigsParam:
 13826  		res.any = &vt.LeftMouseUp
 13827  	case *BetaComputerToolsetConfigsParam:
 13828  		res.any = &vt.LeftMouseUp
 13829  	}
 13830  	return res
 13831  }
 13832  
 13833  // Can have the runtime types [*BetaBrowserLeftMouseUpConfigParam],
 13834  // [*BetaComputerLeftMouseUpConfigParam]
 13835  type betaToolUnionParamConfigsLeftMouseUp struct{ any }
 13836  
 13837  // Use the following switch statement to get the type of the union:
 13838  //
 13839  //	switch u.AsAny().(type) {
 13840  //	case *anthropic.BetaBrowserLeftMouseUpConfigParam:
 13841  //	case *anthropic.BetaComputerLeftMouseUpConfigParam:
 13842  //	default:
 13843  //	    fmt.Errorf("not present")
 13844  //	}
 13845  func (u betaToolUnionParamConfigsLeftMouseUp) AsAny() any { return u.any }
 13846  
 13847  // Returns a pointer to the underlying variant's property, if present.
 13848  func (u betaToolUnionParamConfigsLeftMouseUp) GetDeferLoading() *bool {
 13849  	switch vt := u.any.(type) {
 13850  	case *BetaBrowserLeftMouseUpConfigParam:
 13851  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13852  	case *BetaComputerLeftMouseUpConfigParam:
 13853  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13854  	}
 13855  	return nil
 13856  }
 13857  
 13858  // Returns a pointer to the underlying variant's property, if present.
 13859  func (u betaToolUnionParamConfigsLeftMouseUp) GetEnabled() *bool {
 13860  	switch vt := u.any.(type) {
 13861  	case *BetaBrowserLeftMouseUpConfigParam:
 13862  		return paramutil.AddrIfPresent(vt.Enabled)
 13863  	case *BetaComputerLeftMouseUpConfigParam:
 13864  		return paramutil.AddrIfPresent(vt.Enabled)
 13865  	}
 13866  	return nil
 13867  }
 13868  
 13869  // Returns a subunion which exports methods to access subproperties
 13870  //
 13871  // Or use AsAny() to get the underlying value
 13872  func (u betaToolUnionParamConfigs) GetMiddleClick() (res betaToolUnionParamConfigsMiddleClick) {
 13873  	switch vt := u.any.(type) {
 13874  	case *BetaBrowserToolsetConfigsParam:
 13875  		res.any = &vt.MiddleClick
 13876  	case *BetaComputerToolsetConfigsParam:
 13877  		res.any = &vt.MiddleClick
 13878  	}
 13879  	return res
 13880  }
 13881  
 13882  // Can have the runtime types [*BetaBrowserMiddleClickConfigParam],
 13883  // [*BetaComputerMiddleClickConfigParam]
 13884  type betaToolUnionParamConfigsMiddleClick struct{ any }
 13885  
 13886  // Use the following switch statement to get the type of the union:
 13887  //
 13888  //	switch u.AsAny().(type) {
 13889  //	case *anthropic.BetaBrowserMiddleClickConfigParam:
 13890  //	case *anthropic.BetaComputerMiddleClickConfigParam:
 13891  //	default:
 13892  //	    fmt.Errorf("not present")
 13893  //	}
 13894  func (u betaToolUnionParamConfigsMiddleClick) AsAny() any { return u.any }
 13895  
 13896  // Returns a pointer to the underlying variant's property, if present.
 13897  func (u betaToolUnionParamConfigsMiddleClick) GetDeferLoading() *bool {
 13898  	switch vt := u.any.(type) {
 13899  	case *BetaBrowserMiddleClickConfigParam:
 13900  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13901  	case *BetaComputerMiddleClickConfigParam:
 13902  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13903  	}
 13904  	return nil
 13905  }
 13906  
 13907  // Returns a pointer to the underlying variant's property, if present.
 13908  func (u betaToolUnionParamConfigsMiddleClick) GetEnabled() *bool {
 13909  	switch vt := u.any.(type) {
 13910  	case *BetaBrowserMiddleClickConfigParam:
 13911  		return paramutil.AddrIfPresent(vt.Enabled)
 13912  	case *BetaComputerMiddleClickConfigParam:
 13913  		return paramutil.AddrIfPresent(vt.Enabled)
 13914  	}
 13915  	return nil
 13916  }
 13917  
 13918  // Returns a subunion which exports methods to access subproperties
 13919  //
 13920  // Or use AsAny() to get the underlying value
 13921  func (u betaToolUnionParamConfigs) GetMouseMove() (res betaToolUnionParamConfigsMouseMove) {
 13922  	switch vt := u.any.(type) {
 13923  	case *BetaBrowserToolsetConfigsParam:
 13924  		res.any = &vt.MouseMove
 13925  	case *BetaComputerToolsetConfigsParam:
 13926  		res.any = &vt.MouseMove
 13927  	}
 13928  	return res
 13929  }
 13930  
 13931  // Can have the runtime types [*BetaBrowserMouseMoveConfigParam],
 13932  // [*BetaComputerMouseMoveConfigParam]
 13933  type betaToolUnionParamConfigsMouseMove struct{ any }
 13934  
 13935  // Use the following switch statement to get the type of the union:
 13936  //
 13937  //	switch u.AsAny().(type) {
 13938  //	case *anthropic.BetaBrowserMouseMoveConfigParam:
 13939  //	case *anthropic.BetaComputerMouseMoveConfigParam:
 13940  //	default:
 13941  //	    fmt.Errorf("not present")
 13942  //	}
 13943  func (u betaToolUnionParamConfigsMouseMove) AsAny() any { return u.any }
 13944  
 13945  // Returns a pointer to the underlying variant's property, if present.
 13946  func (u betaToolUnionParamConfigsMouseMove) GetDeferLoading() *bool {
 13947  	switch vt := u.any.(type) {
 13948  	case *BetaBrowserMouseMoveConfigParam:
 13949  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13950  	case *BetaComputerMouseMoveConfigParam:
 13951  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13952  	}
 13953  	return nil
 13954  }
 13955  
 13956  // Returns a pointer to the underlying variant's property, if present.
 13957  func (u betaToolUnionParamConfigsMouseMove) GetEnabled() *bool {
 13958  	switch vt := u.any.(type) {
 13959  	case *BetaBrowserMouseMoveConfigParam:
 13960  		return paramutil.AddrIfPresent(vt.Enabled)
 13961  	case *BetaComputerMouseMoveConfigParam:
 13962  		return paramutil.AddrIfPresent(vt.Enabled)
 13963  	}
 13964  	return nil
 13965  }
 13966  
 13967  // Returns a subunion which exports methods to access subproperties
 13968  //
 13969  // Or use AsAny() to get the underlying value
 13970  func (u betaToolUnionParamConfigs) GetRightClick() (res betaToolUnionParamConfigsRightClick) {
 13971  	switch vt := u.any.(type) {
 13972  	case *BetaBrowserToolsetConfigsParam:
 13973  		res.any = &vt.RightClick
 13974  	case *BetaComputerToolsetConfigsParam:
 13975  		res.any = &vt.RightClick
 13976  	}
 13977  	return res
 13978  }
 13979  
 13980  // Can have the runtime types [*BetaBrowserRightClickConfigParam],
 13981  // [*BetaComputerRightClickConfigParam]
 13982  type betaToolUnionParamConfigsRightClick struct{ any }
 13983  
 13984  // Use the following switch statement to get the type of the union:
 13985  //
 13986  //	switch u.AsAny().(type) {
 13987  //	case *anthropic.BetaBrowserRightClickConfigParam:
 13988  //	case *anthropic.BetaComputerRightClickConfigParam:
 13989  //	default:
 13990  //	    fmt.Errorf("not present")
 13991  //	}
 13992  func (u betaToolUnionParamConfigsRightClick) AsAny() any { return u.any }
 13993  
 13994  // Returns a pointer to the underlying variant's property, if present.
 13995  func (u betaToolUnionParamConfigsRightClick) GetDeferLoading() *bool {
 13996  	switch vt := u.any.(type) {
 13997  	case *BetaBrowserRightClickConfigParam:
 13998  		return paramutil.AddrIfPresent(vt.DeferLoading)
 13999  	case *BetaComputerRightClickConfigParam:
 14000  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14001  	}
 14002  	return nil
 14003  }
 14004  
 14005  // Returns a pointer to the underlying variant's property, if present.
 14006  func (u betaToolUnionParamConfigsRightClick) GetEnabled() *bool {
 14007  	switch vt := u.any.(type) {
 14008  	case *BetaBrowserRightClickConfigParam:
 14009  		return paramutil.AddrIfPresent(vt.Enabled)
 14010  	case *BetaComputerRightClickConfigParam:
 14011  		return paramutil.AddrIfPresent(vt.Enabled)
 14012  	}
 14013  	return nil
 14014  }
 14015  
 14016  // Returns a subunion which exports methods to access subproperties
 14017  //
 14018  // Or use AsAny() to get the underlying value
 14019  func (u betaToolUnionParamConfigs) GetScreenshot() (res betaToolUnionParamConfigsScreenshot) {
 14020  	switch vt := u.any.(type) {
 14021  	case *BetaBrowserToolsetConfigsParam:
 14022  		res.any = &vt.Screenshot
 14023  	case *BetaComputerToolsetConfigsParam:
 14024  		res.any = &vt.Screenshot
 14025  	}
 14026  	return res
 14027  }
 14028  
 14029  // Can have the runtime types [*BetaBrowserScreenshotConfigParam],
 14030  // [*BetaComputerScreenshotConfigParam]
 14031  type betaToolUnionParamConfigsScreenshot struct{ any }
 14032  
 14033  // Use the following switch statement to get the type of the union:
 14034  //
 14035  //	switch u.AsAny().(type) {
 14036  //	case *anthropic.BetaBrowserScreenshotConfigParam:
 14037  //	case *anthropic.BetaComputerScreenshotConfigParam:
 14038  //	default:
 14039  //	    fmt.Errorf("not present")
 14040  //	}
 14041  func (u betaToolUnionParamConfigsScreenshot) AsAny() any { return u.any }
 14042  
 14043  // Returns a pointer to the underlying variant's property, if present.
 14044  func (u betaToolUnionParamConfigsScreenshot) GetDeferLoading() *bool {
 14045  	switch vt := u.any.(type) {
 14046  	case *BetaBrowserScreenshotConfigParam:
 14047  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14048  	case *BetaComputerScreenshotConfigParam:
 14049  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14050  	}
 14051  	return nil
 14052  }
 14053  
 14054  // Returns a pointer to the underlying variant's property, if present.
 14055  func (u betaToolUnionParamConfigsScreenshot) GetEnabled() *bool {
 14056  	switch vt := u.any.(type) {
 14057  	case *BetaBrowserScreenshotConfigParam:
 14058  		return paramutil.AddrIfPresent(vt.Enabled)
 14059  	case *BetaComputerScreenshotConfigParam:
 14060  		return paramutil.AddrIfPresent(vt.Enabled)
 14061  	}
 14062  	return nil
 14063  }
 14064  
 14065  // Returns a subunion which exports methods to access subproperties
 14066  //
 14067  // Or use AsAny() to get the underlying value
 14068  func (u betaToolUnionParamConfigs) GetScroll() (res betaToolUnionParamConfigsScroll) {
 14069  	switch vt := u.any.(type) {
 14070  	case *BetaBrowserToolsetConfigsParam:
 14071  		res.any = &vt.Scroll
 14072  	case *BetaComputerToolsetConfigsParam:
 14073  		res.any = &vt.Scroll
 14074  	}
 14075  	return res
 14076  }
 14077  
 14078  // Can have the runtime types [*BetaBrowserScrollConfigParam],
 14079  // [*BetaComputerScrollConfigParam]
 14080  type betaToolUnionParamConfigsScroll struct{ any }
 14081  
 14082  // Use the following switch statement to get the type of the union:
 14083  //
 14084  //	switch u.AsAny().(type) {
 14085  //	case *anthropic.BetaBrowserScrollConfigParam:
 14086  //	case *anthropic.BetaComputerScrollConfigParam:
 14087  //	default:
 14088  //	    fmt.Errorf("not present")
 14089  //	}
 14090  func (u betaToolUnionParamConfigsScroll) AsAny() any { return u.any }
 14091  
 14092  // Returns a pointer to the underlying variant's property, if present.
 14093  func (u betaToolUnionParamConfigsScroll) GetDeferLoading() *bool {
 14094  	switch vt := u.any.(type) {
 14095  	case *BetaBrowserScrollConfigParam:
 14096  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14097  	case *BetaComputerScrollConfigParam:
 14098  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14099  	}
 14100  	return nil
 14101  }
 14102  
 14103  // Returns a pointer to the underlying variant's property, if present.
 14104  func (u betaToolUnionParamConfigsScroll) GetEnabled() *bool {
 14105  	switch vt := u.any.(type) {
 14106  	case *BetaBrowserScrollConfigParam:
 14107  		return paramutil.AddrIfPresent(vt.Enabled)
 14108  	case *BetaComputerScrollConfigParam:
 14109  		return paramutil.AddrIfPresent(vt.Enabled)
 14110  	}
 14111  	return nil
 14112  }
 14113  
 14114  // Returns a subunion which exports methods to access subproperties
 14115  //
 14116  // Or use AsAny() to get the underlying value
 14117  func (u betaToolUnionParamConfigs) GetTripleClick() (res betaToolUnionParamConfigsTripleClick) {
 14118  	switch vt := u.any.(type) {
 14119  	case *BetaBrowserToolsetConfigsParam:
 14120  		res.any = &vt.TripleClick
 14121  	case *BetaComputerToolsetConfigsParam:
 14122  		res.any = &vt.TripleClick
 14123  	}
 14124  	return res
 14125  }
 14126  
 14127  // Can have the runtime types [*BetaBrowserTripleClickConfigParam],
 14128  // [*BetaComputerTripleClickConfigParam]
 14129  type betaToolUnionParamConfigsTripleClick struct{ any }
 14130  
 14131  // Use the following switch statement to get the type of the union:
 14132  //
 14133  //	switch u.AsAny().(type) {
 14134  //	case *anthropic.BetaBrowserTripleClickConfigParam:
 14135  //	case *anthropic.BetaComputerTripleClickConfigParam:
 14136  //	default:
 14137  //	    fmt.Errorf("not present")
 14138  //	}
 14139  func (u betaToolUnionParamConfigsTripleClick) AsAny() any { return u.any }
 14140  
 14141  // Returns a pointer to the underlying variant's property, if present.
 14142  func (u betaToolUnionParamConfigsTripleClick) GetDeferLoading() *bool {
 14143  	switch vt := u.any.(type) {
 14144  	case *BetaBrowserTripleClickConfigParam:
 14145  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14146  	case *BetaComputerTripleClickConfigParam:
 14147  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14148  	}
 14149  	return nil
 14150  }
 14151  
 14152  // Returns a pointer to the underlying variant's property, if present.
 14153  func (u betaToolUnionParamConfigsTripleClick) GetEnabled() *bool {
 14154  	switch vt := u.any.(type) {
 14155  	case *BetaBrowserTripleClickConfigParam:
 14156  		return paramutil.AddrIfPresent(vt.Enabled)
 14157  	case *BetaComputerTripleClickConfigParam:
 14158  		return paramutil.AddrIfPresent(vt.Enabled)
 14159  	}
 14160  	return nil
 14161  }
 14162  
 14163  // Returns a subunion which exports methods to access subproperties
 14164  //
 14165  // Or use AsAny() to get the underlying value
 14166  func (u betaToolUnionParamConfigs) GetType() (res betaToolUnionParamConfigsType) {
 14167  	switch vt := u.any.(type) {
 14168  	case *BetaBrowserToolsetConfigsParam:
 14169  		res.any = &vt.Type
 14170  	case *BetaComputerToolsetConfigsParam:
 14171  		res.any = &vt.Type
 14172  	}
 14173  	return res
 14174  }
 14175  
 14176  // Can have the runtime types [*BetaBrowserTypeConfigParam],
 14177  // [*BetaComputerTypeConfigParam]
 14178  type betaToolUnionParamConfigsType struct{ any }
 14179  
 14180  // Use the following switch statement to get the type of the union:
 14181  //
 14182  //	switch u.AsAny().(type) {
 14183  //	case *anthropic.BetaBrowserTypeConfigParam:
 14184  //	case *anthropic.BetaComputerTypeConfigParam:
 14185  //	default:
 14186  //	    fmt.Errorf("not present")
 14187  //	}
 14188  func (u betaToolUnionParamConfigsType) AsAny() any { return u.any }
 14189  
 14190  // Returns a pointer to the underlying variant's property, if present.
 14191  func (u betaToolUnionParamConfigsType) GetDeferLoading() *bool {
 14192  	switch vt := u.any.(type) {
 14193  	case *BetaBrowserTypeConfigParam:
 14194  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14195  	case *BetaComputerTypeConfigParam:
 14196  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14197  	}
 14198  	return nil
 14199  }
 14200  
 14201  // Returns a pointer to the underlying variant's property, if present.
 14202  func (u betaToolUnionParamConfigsType) GetEnabled() *bool {
 14203  	switch vt := u.any.(type) {
 14204  	case *BetaBrowserTypeConfigParam:
 14205  		return paramutil.AddrIfPresent(vt.Enabled)
 14206  	case *BetaComputerTypeConfigParam:
 14207  		return paramutil.AddrIfPresent(vt.Enabled)
 14208  	}
 14209  	return nil
 14210  }
 14211  
 14212  // Returns a subunion which exports methods to access subproperties
 14213  //
 14214  // Or use AsAny() to get the underlying value
 14215  func (u betaToolUnionParamConfigs) GetWait() (res betaToolUnionParamConfigsWait) {
 14216  	switch vt := u.any.(type) {
 14217  	case *BetaBrowserToolsetConfigsParam:
 14218  		res.any = &vt.Wait
 14219  	case *BetaComputerToolsetConfigsParam:
 14220  		res.any = &vt.Wait
 14221  	}
 14222  	return res
 14223  }
 14224  
 14225  // Can have the runtime types [*BetaBrowserWaitConfigParam],
 14226  // [*BetaComputerWaitConfigParam]
 14227  type betaToolUnionParamConfigsWait struct{ any }
 14228  
 14229  // Use the following switch statement to get the type of the union:
 14230  //
 14231  //	switch u.AsAny().(type) {
 14232  //	case *anthropic.BetaBrowserWaitConfigParam:
 14233  //	case *anthropic.BetaComputerWaitConfigParam:
 14234  //	default:
 14235  //	    fmt.Errorf("not present")
 14236  //	}
 14237  func (u betaToolUnionParamConfigsWait) AsAny() any { return u.any }
 14238  
 14239  // Returns a pointer to the underlying variant's property, if present.
 14240  func (u betaToolUnionParamConfigsWait) GetDeferLoading() *bool {
 14241  	switch vt := u.any.(type) {
 14242  	case *BetaBrowserWaitConfigParam:
 14243  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14244  	case *BetaComputerWaitConfigParam:
 14245  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14246  	}
 14247  	return nil
 14248  }
 14249  
 14250  // Returns a pointer to the underlying variant's property, if present.
 14251  func (u betaToolUnionParamConfigsWait) GetEnabled() *bool {
 14252  	switch vt := u.any.(type) {
 14253  	case *BetaBrowserWaitConfigParam:
 14254  		return paramutil.AddrIfPresent(vt.Enabled)
 14255  	case *BetaComputerWaitConfigParam:
 14256  		return paramutil.AddrIfPresent(vt.Enabled)
 14257  	}
 14258  	return nil
 14259  }
 14260  
 14261  // Returns a subunion which exports methods to access subproperties
 14262  //
 14263  // Or use AsAny() to get the underlying value
 14264  func (u betaToolUnionParamConfigs) GetZoom() (res betaToolUnionParamConfigsZoom) {
 14265  	switch vt := u.any.(type) {
 14266  	case *BetaBrowserToolsetConfigsParam:
 14267  		res.any = &vt.Zoom
 14268  	case *BetaComputerToolsetConfigsParam:
 14269  		res.any = &vt.Zoom
 14270  	}
 14271  	return res
 14272  }
 14273  
 14274  // Can have the runtime types [*BetaBrowserZoomConfigParam],
 14275  // [*BetaComputerZoomConfigParam]
 14276  type betaToolUnionParamConfigsZoom struct{ any }
 14277  
 14278  // Use the following switch statement to get the type of the union:
 14279  //
 14280  //	switch u.AsAny().(type) {
 14281  //	case *anthropic.BetaBrowserZoomConfigParam:
 14282  //	case *anthropic.BetaComputerZoomConfigParam:
 14283  //	default:
 14284  //	    fmt.Errorf("not present")
 14285  //	}
 14286  func (u betaToolUnionParamConfigsZoom) AsAny() any { return u.any }
 14287  
 14288  // Returns a pointer to the underlying variant's property, if present.
 14289  func (u betaToolUnionParamConfigsZoom) GetDeferLoading() *bool {
 14290  	switch vt := u.any.(type) {
 14291  	case *BetaBrowserZoomConfigParam:
 14292  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14293  	case *BetaComputerZoomConfigParam:
 14294  		return paramutil.AddrIfPresent(vt.DeferLoading)
 14295  	}
 14296  	return nil
 14297  }
 14298  
 14299  // Returns a pointer to the underlying variant's property, if present.
 14300  func (u betaToolUnionParamConfigsZoom) GetEnabled() *bool {
 14301  	switch vt := u.any.(type) {
 14302  	case *BetaBrowserZoomConfigParam:
 14303  		return paramutil.AddrIfPresent(vt.Enabled)
 14304  	case *BetaComputerZoomConfigParam:
 14305  		return paramutil.AddrIfPresent(vt.Enabled)
 14306  	}
 14307  	return nil
 14308  }
 14309  
 14310  // Returns a pointer to the underlying variant's AllowedDomains property, if
 14311  // present.
 14312  func (u BetaToolUnionParam) GetAllowedDomains() []string {
 14313  	if vt := u.OfWebSearchTool20250305; vt != nil {
 14314  		return vt.AllowedDomains
 14315  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 14316  		return vt.AllowedDomains
 14317  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 14318  		return vt.AllowedDomains
 14319  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 14320  		return vt.AllowedDomains
 14321  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 14322  		return vt.AllowedDomains
 14323  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 14324  		return vt.AllowedDomains
 14325  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 14326  		return vt.AllowedDomains
 14327  	}
 14328  	return nil
 14329  }
 14330  
 14331  // Returns a pointer to the underlying variant's BlockedDomains property, if
 14332  // present.
 14333  func (u BetaToolUnionParam) GetBlockedDomains() []string {
 14334  	if vt := u.OfWebSearchTool20250305; vt != nil {
 14335  		return vt.BlockedDomains
 14336  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 14337  		return vt.BlockedDomains
 14338  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 14339  		return vt.BlockedDomains
 14340  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 14341  		return vt.BlockedDomains
 14342  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 14343  		return vt.BlockedDomains
 14344  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 14345  		return vt.BlockedDomains
 14346  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 14347  		return vt.BlockedDomains
 14348  	}
 14349  	return nil
 14350  }
 14351  
 14352  // Returns a pointer to the underlying variant's UserLocation property, if present.
 14353  func (u BetaToolUnionParam) GetUserLocation() *BetaUserLocationParam {
 14354  	if vt := u.OfWebSearchTool20250305; vt != nil {
 14355  		return &vt.UserLocation
 14356  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 14357  		return &vt.UserLocation
 14358  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 14359  		return &vt.UserLocation
 14360  	}
 14361  	return nil
 14362  }
 14363  
 14364  // Returns a pointer to the underlying variant's Citations property, if present.
 14365  func (u BetaToolUnionParam) GetCitations() *BetaCitationsConfigParam {
 14366  	if vt := u.OfWebFetchTool20250910; vt != nil {
 14367  		return &vt.Citations
 14368  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 14369  		return &vt.Citations
 14370  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 14371  		return &vt.Citations
 14372  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 14373  		return &vt.Citations
 14374  	}
 14375  	return nil
 14376  }
 14377  
 14378  type BetaToolUseBlock struct {
 14379  	ID    string           `json:"id" api:"required"`
 14380  	Input any              `json:"input" api:"required"`
 14381  	Name  string           `json:"name" api:"required"`
 14382  	Type  constant.ToolUse `json:"type" default:"tool_use"`
 14383  	// Tool invocation directly from the model.
 14384  	Caller BetaToolUseBlockCallerUnion `json:"caller"`
 14385  	// For a toolset member tool_use, the toolset family.
 14386  	ToolsetName string `json:"toolset_name" api:"nullable"`
 14387  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 14388  	JSON struct {
 14389  		ID          respjson.Field
 14390  		Input       respjson.Field
 14391  		Name        respjson.Field
 14392  		Type        respjson.Field
 14393  		Caller      respjson.Field
 14394  		ToolsetName respjson.Field
 14395  		ExtraFields map[string]respjson.Field
 14396  		raw         string
 14397  	} `json:"-"`
 14398  }
 14399  
 14400  // Returns the unmodified JSON received from the API
 14401  func (r BetaToolUseBlock) RawJSON() string { return r.JSON.raw }
 14402  func (r *BetaToolUseBlock) UnmarshalJSON(data []byte) error {
 14403  	return apijson.UnmarshalRoot(data, r)
 14404  }
 14405  
 14406  // BetaToolUseBlockCallerUnion contains all possible properties and values from
 14407  // [BetaDirectCaller], [BetaServerToolCaller], [BetaServerToolCaller20260120].
 14408  //
 14409  // Use the [BetaToolUseBlockCallerUnion.AsAny] method to switch on the variant.
 14410  //
 14411  // Use the methods beginning with 'As' to cast the union to one of its variants.
 14412  type BetaToolUseBlockCallerUnion struct {
 14413  	// Any of "direct", "code_execution_20250825", "code_execution_20260120".
 14414  	Type   string `json:"type"`
 14415  	ToolID string `json:"tool_id"`
 14416  	JSON   struct {
 14417  		Type   respjson.Field
 14418  		ToolID respjson.Field
 14419  		raw    string
 14420  	} `json:"-"`
 14421  }
 14422  
 14423  // anyBetaToolUseBlockCaller is implemented by each variant of
 14424  // [BetaToolUseBlockCallerUnion] to add type safety for the return type of
 14425  // [BetaToolUseBlockCallerUnion.AsAny]
 14426  type anyBetaToolUseBlockCaller interface {
 14427  	implBetaToolUseBlockCallerUnion()
 14428  }
 14429  
 14430  func (BetaDirectCaller) implBetaToolUseBlockCallerUnion()             {}
 14431  func (BetaServerToolCaller) implBetaToolUseBlockCallerUnion()         {}
 14432  func (BetaServerToolCaller20260120) implBetaToolUseBlockCallerUnion() {}
 14433  
 14434  // Use the following switch statement to find the correct variant
 14435  //
 14436  //	switch variant := BetaToolUseBlockCallerUnion.AsAny().(type) {
 14437  //	case anthropic.BetaDirectCaller:
 14438  //	case anthropic.BetaServerToolCaller:
 14439  //	case anthropic.BetaServerToolCaller20260120:
 14440  //	default:
 14441  //	  fmt.Errorf("no variant present")
 14442  //	}
 14443  func (u BetaToolUseBlockCallerUnion) AsAny() anyBetaToolUseBlockCaller {
 14444  	switch u.Type {
 14445  	case "direct":
 14446  		return u.AsDirect()
 14447  	case "code_execution_20250825":
 14448  		return u.AsCodeExecution20250825()
 14449  	case "code_execution_20260120":
 14450  		return u.AsCodeExecution20260120()
 14451  	}
 14452  	return nil
 14453  }
 14454  
 14455  func (u BetaToolUseBlockCallerUnion) AsDirect() (v BetaDirectCaller) {
 14456  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 14457  	return
 14458  }
 14459  
 14460  func (u BetaToolUseBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller) {
 14461  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 14462  	return
 14463  }
 14464  
 14465  func (u BetaToolUseBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120) {
 14466  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 14467  	return
 14468  }
 14469  
 14470  // Returns the unmodified JSON received from the API
 14471  func (u BetaToolUseBlockCallerUnion) RawJSON() string { return u.JSON.raw }
 14472  
 14473  func (r *BetaToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error {
 14474  	return apijson.UnmarshalRoot(data, r)
 14475  }
 14476  
 14477  // The properties ID, Input, Name, Type are required.
 14478  type BetaToolUseBlockParam struct {
 14479  	ID    string `json:"id" api:"required"`
 14480  	Input any    `json:"input,omitzero" api:"required"`
 14481  	Name  string `json:"name" api:"required"`
 14482  	// For a toolset member tool_use, the toolset family this member belongs to.
 14483  	ToolsetName param.Opt[string] `json:"toolset_name,omitzero"`
 14484  	// Create a cache control breakpoint at this content block.
 14485  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 14486  	// Tool invocation directly from the model.
 14487  	Caller BetaToolUseBlockParamCallerUnion `json:"caller,omitzero"`
 14488  	// This field can be elided, and will marshal its zero value as "tool_use".
 14489  	Type constant.ToolUse `json:"type" default:"tool_use"`
 14490  	paramObj
 14491  }
 14492  
 14493  func (r BetaToolUseBlockParam) MarshalJSON() (data []byte, err error) {
 14494  	type shadow BetaToolUseBlockParam
 14495  	return param.MarshalObject(r, (*shadow)(&r))
 14496  }
 14497  func (r *BetaToolUseBlockParam) UnmarshalJSON(data []byte) error {
 14498  	return apijson.UnmarshalRoot(data, r)
 14499  }
 14500  
 14501  // Only one field can be non-zero.
 14502  //
 14503  // Use [param.IsOmitted] to confirm if a field is set.
 14504  type BetaToolUseBlockParamCallerUnion struct {
 14505  	OfDirect                *BetaDirectCallerParam             `json:",omitzero,inline"`
 14506  	OfCodeExecution20250825 *BetaServerToolCallerParam         `json:",omitzero,inline"`
 14507  	OfCodeExecution20260120 *BetaServerToolCaller20260120Param `json:",omitzero,inline"`
 14508  	paramUnion
 14509  }
 14510  
 14511  func (u BetaToolUseBlockParamCallerUnion) MarshalJSON() ([]byte, error) {
 14512  	return param.MarshalUnion(u, u.OfDirect, u.OfCodeExecution20250825, u.OfCodeExecution20260120)
 14513  }
 14514  func (u *BetaToolUseBlockParamCallerUnion) UnmarshalJSON(data []byte) error {
 14515  	return apijson.UnmarshalRoot(data, u)
 14516  }
 14517  
 14518  func (u *BetaToolUseBlockParamCallerUnion) asAny() any {
 14519  	if !param.IsOmitted(u.OfDirect) {
 14520  		return u.OfDirect
 14521  	} else if !param.IsOmitted(u.OfCodeExecution20250825) {
 14522  		return u.OfCodeExecution20250825
 14523  	} else if !param.IsOmitted(u.OfCodeExecution20260120) {
 14524  		return u.OfCodeExecution20260120
 14525  	}
 14526  	return nil
 14527  }
 14528  
 14529  // Returns a pointer to the underlying variant's property, if present.
 14530  func (u BetaToolUseBlockParamCallerUnion) GetType() *string {
 14531  	if vt := u.OfDirect; vt != nil {
 14532  		return (*string)(&vt.Type)
 14533  	} else if vt := u.OfCodeExecution20250825; vt != nil {
 14534  		return (*string)(&vt.Type)
 14535  	} else if vt := u.OfCodeExecution20260120; vt != nil {
 14536  		return (*string)(&vt.Type)
 14537  	}
 14538  	return nil
 14539  }
 14540  
 14541  // Returns a pointer to the underlying variant's property, if present.
 14542  func (u BetaToolUseBlockParamCallerUnion) GetToolID() *string {
 14543  	if vt := u.OfCodeExecution20250825; vt != nil {
 14544  		return (*string)(&vt.ToolID)
 14545  	} else if vt := u.OfCodeExecution20260120; vt != nil {
 14546  		return (*string)(&vt.ToolID)
 14547  	}
 14548  	return nil
 14549  }
 14550  
 14551  func init() {
 14552  	apijson.RegisterUnion[BetaToolUseBlockParamCallerUnion](
 14553  		"type",
 14554  		apijson.Discriminator[BetaDirectCallerParam]("direct"),
 14555  		apijson.Discriminator[BetaServerToolCallerParam]("code_execution_20250825"),
 14556  		apijson.Discriminator[BetaServerToolCaller20260120Param]("code_execution_20260120"),
 14557  	)
 14558  }
 14559  
 14560  // The properties Type, Value are required.
 14561  type BetaToolUsesKeepParam struct {
 14562  	Value int64 `json:"value" api:"required"`
 14563  	// This field can be elided, and will marshal its zero value as "tool_uses".
 14564  	Type constant.ToolUses `json:"type" default:"tool_uses"`
 14565  	paramObj
 14566  }
 14567  
 14568  func (r BetaToolUsesKeepParam) MarshalJSON() (data []byte, err error) {
 14569  	type shadow BetaToolUsesKeepParam
 14570  	return param.MarshalObject(r, (*shadow)(&r))
 14571  }
 14572  func (r *BetaToolUsesKeepParam) UnmarshalJSON(data []byte) error {
 14573  	return apijson.UnmarshalRoot(data, r)
 14574  }
 14575  
 14576  // The properties Type, Value are required.
 14577  type BetaToolUsesTriggerParam struct {
 14578  	Value int64 `json:"value" api:"required"`
 14579  	// This field can be elided, and will marshal its zero value as "tool_uses".
 14580  	Type constant.ToolUses `json:"type" default:"tool_uses"`
 14581  	paramObj
 14582  }
 14583  
 14584  func (r BetaToolUsesTriggerParam) MarshalJSON() (data []byte, err error) {
 14585  	type shadow BetaToolUsesTriggerParam
 14586  	return param.MarshalObject(r, (*shadow)(&r))
 14587  }
 14588  func (r *BetaToolUsesTriggerParam) UnmarshalJSON(data []byte) error {
 14589  	return apijson.UnmarshalRoot(data, r)
 14590  }
 14591  
 14592  // The properties Type, URL are required.
 14593  type BetaURLImageSourceParam struct {
 14594  	URL string `json:"url" api:"required"`
 14595  	// This field can be elided, and will marshal its zero value as "url".
 14596  	Type constant.URL `json:"type" default:"url"`
 14597  	paramObj
 14598  }
 14599  
 14600  func (r BetaURLImageSourceParam) MarshalJSON() (data []byte, err error) {
 14601  	type shadow BetaURLImageSourceParam
 14602  	return param.MarshalObject(r, (*shadow)(&r))
 14603  }
 14604  func (r *BetaURLImageSourceParam) UnmarshalJSON(data []byte) error {
 14605  	return apijson.UnmarshalRoot(data, r)
 14606  }
 14607  
 14608  // The properties Type, URL are required.
 14609  type BetaURLPDFSourceParam struct {
 14610  	URL string `json:"url" api:"required"`
 14611  	// This field can be elided, and will marshal its zero value as "url".
 14612  	Type constant.URL `json:"type" default:"url"`
 14613  	paramObj
 14614  }
 14615  
 14616  func (r BetaURLPDFSourceParam) MarshalJSON() (data []byte, err error) {
 14617  	type shadow BetaURLPDFSourceParam
 14618  	return param.MarshalObject(r, (*shadow)(&r))
 14619  }
 14620  func (r *BetaURLPDFSourceParam) UnmarshalJSON(data []byte) error {
 14621  	return apijson.UnmarshalRoot(data, r)
 14622  }
 14623  
 14624  type BetaUsage struct {
 14625  	// Breakdown of cached tokens by TTL
 14626  	CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
 14627  	// The number of input tokens used to create the cache entry.
 14628  	CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
 14629  	// The number of input tokens read from the cache.
 14630  	CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
 14631  	// Outcome of the `fallback_credit_token` presented on this request.
 14632  	FallbackCredit BetaFallbackCreditUsage `json:"fallback_credit" api:"required"`
 14633  	// The geographic region where inference was performed for this request.
 14634  	InferenceGeo string `json:"inference_geo" api:"required"`
 14635  	// The number of input tokens which were used.
 14636  	InputTokens int64 `json:"input_tokens" api:"required"`
 14637  	// Per-iteration token usage breakdown.
 14638  	//
 14639  	// Each entry represents one sampling iteration, with its own input/output token
 14640  	// counts and cache statistics, discriminated by `type`. For `message` entries
 14641  	// (model sampling iterations, such as the turns of a server-side tool use loop),
 14642  	// this allows you to:
 14643  	//
 14644  	// - Determine which iterations exceeded long context thresholds (>=200k tokens)
 14645  	// - Calculate the context window size from the last `message` entry
 14646  	// - Understand token accumulation across server-side tool use loops
 14647  	//
 14648  	// A `compaction` entry reports the token usage of the compaction operation itself
 14649  	// — the server-side request that summarizes the context being closed — NOT the
 14650  	// size of the context that was compacted away, and its token counts can be much
 14651  	// smaller than that closed context (for example, a compaction that closes a
 14652  	// ~200k-token context can report only a few thousand tokens). Do not derive the
 14653  	// context window size from a `compaction` entry, even when it is the last entry. A
 14654  	// `compaction` entry's tokens are not included in the top-level `usage` fields.
 14655  	// When an input-token trigger is in effect (the default — 150,000 tokens unless
 14656  	// configured otherwise), each `compaction` entry closes a context that had reached
 14657  	// at least that threshold, though the context can exceed it by the final
 14658  	// iteration's output and tool results.
 14659  	Iterations BetaIterationsUsage `json:"iterations" api:"required"`
 14660  	// The number of output tokens which were used.
 14661  	OutputTokens int64 `json:"output_tokens" api:"required"`
 14662  	// Breakdown of output tokens by category.
 14663  	//
 14664  	// `output_tokens` remains the inclusive, authoritative total used for billing.
 14665  	// This object provides a read-only decomposition for observability — for example,
 14666  	// how many of the billed output tokens were spent on internal reasoning that may
 14667  	// have been summarized before being returned to you.
 14668  	OutputTokensDetails BetaOutputTokensDetails `json:"output_tokens_details" api:"required"`
 14669  	// The number of server tool requests.
 14670  	ServerToolUse BetaServerToolUsage `json:"server_tool_use" api:"required"`
 14671  	// If the request used the priority, standard, or batch tier.
 14672  	//
 14673  	// Any of "standard", "priority", "batch".
 14674  	ServiceTier BetaUsageServiceTier `json:"service_tier" api:"required"`
 14675  	// Inference speed mode. `fast` provides significantly faster output token
 14676  	// generation at premium pricing. Not all models support `fast`; invalid
 14677  	// combinations are rejected at create time.
 14678  	//
 14679  	// Any of "standard", "fast".
 14680  	Speed BetaUsageSpeed `json:"speed" api:"required"`
 14681  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 14682  	JSON struct {
 14683  		CacheCreation            respjson.Field
 14684  		CacheCreationInputTokens respjson.Field
 14685  		CacheReadInputTokens     respjson.Field
 14686  		FallbackCredit           respjson.Field
 14687  		InferenceGeo             respjson.Field
 14688  		InputTokens              respjson.Field
 14689  		Iterations               respjson.Field
 14690  		OutputTokens             respjson.Field
 14691  		OutputTokensDetails      respjson.Field
 14692  		ServerToolUse            respjson.Field
 14693  		ServiceTier              respjson.Field
 14694  		Speed                    respjson.Field
 14695  		ExtraFields              map[string]respjson.Field
 14696  		raw                      string
 14697  	} `json:"-"`
 14698  }
 14699  
 14700  // Returns the unmodified JSON received from the API
 14701  func (r BetaUsage) RawJSON() string { return r.JSON.raw }
 14702  func (r *BetaUsage) UnmarshalJSON(data []byte) error {
 14703  	return apijson.UnmarshalRoot(data, r)
 14704  }
 14705  
 14706  // If the request used the priority, standard, or batch tier.
 14707  type BetaUsageServiceTier string
 14708  
 14709  const (
 14710  	BetaUsageServiceTierStandard BetaUsageServiceTier = "standard"
 14711  	BetaUsageServiceTierPriority BetaUsageServiceTier = "priority"
 14712  	BetaUsageServiceTierBatch    BetaUsageServiceTier = "batch"
 14713  )
 14714  
 14715  // Inference speed mode. `fast` provides significantly faster output token
 14716  // generation at premium pricing. Not all models support `fast`; invalid
 14717  // combinations are rejected at create time.
 14718  type BetaUsageSpeed string
 14719  
 14720  const (
 14721  	BetaUsageSpeedStandard BetaUsageSpeed = "standard"
 14722  	BetaUsageSpeedFast     BetaUsageSpeed = "fast"
 14723  )
 14724  
 14725  // The property Type is required.
 14726  type BetaUserLocationParam struct {
 14727  	// The city of the user.
 14728  	City param.Opt[string] `json:"city,omitzero"`
 14729  	// The two letter
 14730  	// [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
 14731  	// user.
 14732  	Country param.Opt[string] `json:"country,omitzero"`
 14733  	// The region of the user.
 14734  	Region param.Opt[string] `json:"region,omitzero"`
 14735  	// The [IANA timezone](https://nodatime.org/TimeZones) of the user.
 14736  	Timezone param.Opt[string] `json:"timezone,omitzero"`
 14737  	// This field can be elided, and will marshal its zero value as "approximate".
 14738  	Type constant.Approximate `json:"type" default:"approximate"`
 14739  	paramObj
 14740  }
 14741  
 14742  func (r BetaUserLocationParam) MarshalJSON() (data []byte, err error) {
 14743  	type shadow BetaUserLocationParam
 14744  	return param.MarshalObject(r, (*shadow)(&r))
 14745  }
 14746  func (r *BetaUserLocationParam) UnmarshalJSON(data []byte) error {
 14747  	return apijson.UnmarshalRoot(data, r)
 14748  }
 14749  
 14750  type BetaWebFetchBlock struct {
 14751  	Content BetaDocumentBlock `json:"content" api:"required"`
 14752  	// ISO 8601 timestamp when the content was retrieved
 14753  	RetrievedAt string                  `json:"retrieved_at" api:"required"`
 14754  	Type        constant.WebFetchResult `json:"type" default:"web_fetch_result"`
 14755  	// Fetched content URL
 14756  	URL string `json:"url" api:"required"`
 14757  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 14758  	JSON struct {
 14759  		Content     respjson.Field
 14760  		RetrievedAt respjson.Field
 14761  		Type        respjson.Field
 14762  		URL         respjson.Field
 14763  		ExtraFields map[string]respjson.Field
 14764  		raw         string
 14765  	} `json:"-"`
 14766  }
 14767  
 14768  // Returns the unmodified JSON received from the API
 14769  func (r BetaWebFetchBlock) RawJSON() string { return r.JSON.raw }
 14770  func (r *BetaWebFetchBlock) UnmarshalJSON(data []byte) error {
 14771  	return apijson.UnmarshalRoot(data, r)
 14772  }
 14773  
 14774  // The properties Content, Type, URL are required.
 14775  type BetaWebFetchBlockParam struct {
 14776  	Content BetaRequestDocumentBlockParam `json:"content,omitzero" api:"required"`
 14777  	// Fetched content URL
 14778  	URL string `json:"url" api:"required"`
 14779  	// ISO 8601 timestamp when the content was retrieved
 14780  	RetrievedAt param.Opt[string] `json:"retrieved_at,omitzero"`
 14781  	// This field can be elided, and will marshal its zero value as "web_fetch_result".
 14782  	Type constant.WebFetchResult `json:"type" default:"web_fetch_result"`
 14783  	paramObj
 14784  }
 14785  
 14786  func (r BetaWebFetchBlockParam) MarshalJSON() (data []byte, err error) {
 14787  	type shadow BetaWebFetchBlockParam
 14788  	return param.MarshalObject(r, (*shadow)(&r))
 14789  }
 14790  func (r *BetaWebFetchBlockParam) UnmarshalJSON(data []byte) error {
 14791  	return apijson.UnmarshalRoot(data, r)
 14792  }
 14793  
 14794  // The properties Name, Type are required.
 14795  type BetaWebFetchTool20250910Param struct {
 14796  	// Maximum number of tokens used by including web page text content in the context.
 14797  	// The limit is approximate and does not apply to binary content such as PDFs.
 14798  	MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
 14799  	// Maximum number of times the tool can be used in the API request.
 14800  	MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
 14801  	// If true, tool will not be included in initial system prompt. Only loaded when
 14802  	// returned via tool_reference from tool search.
 14803  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 14804  	// When true, guarantees schema validation on tool names and inputs
 14805  	Strict param.Opt[bool] `json:"strict,omitzero"`
 14806  	// List of domains to allow fetching from
 14807  	AllowedDomains []string `json:"allowed_domains,omitzero"`
 14808  	// List of domains to block fetching from
 14809  	BlockedDomains []string `json:"blocked_domains,omitzero"`
 14810  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 14811  	// "code_execution_20260521".
 14812  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 14813  	// Create a cache control breakpoint at this content block.
 14814  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 14815  	// Citations configuration for fetched documents. Citations are disabled by
 14816  	// default.
 14817  	Citations BetaCitationsConfigParam `json:"citations,omitzero"`
 14818  	// Name of the tool.
 14819  	//
 14820  	// This is how the tool will be called by the model and in `tool_use` blocks.
 14821  	//
 14822  	// This field can be elided, and will marshal its zero value as "web_fetch".
 14823  	Name constant.WebFetch `json:"name" default:"web_fetch"`
 14824  	// This field can be elided, and will marshal its zero value as
 14825  	// "web_fetch_20250910".
 14826  	Type constant.WebFetch20250910 `json:"type" default:"web_fetch_20250910"`
 14827  	paramObj
 14828  }
 14829  
 14830  func (r BetaWebFetchTool20250910Param) MarshalJSON() (data []byte, err error) {
 14831  	type shadow BetaWebFetchTool20250910Param
 14832  	return param.MarshalObject(r, (*shadow)(&r))
 14833  }
 14834  func (r *BetaWebFetchTool20250910Param) UnmarshalJSON(data []byte) error {
 14835  	return apijson.UnmarshalRoot(data, r)
 14836  }
 14837  
 14838  // The properties Name, Type are required.
 14839  type BetaWebFetchTool20260209Param struct {
 14840  	// Maximum number of tokens used by including web page text content in the context.
 14841  	// The limit is approximate and does not apply to binary content such as PDFs.
 14842  	MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
 14843  	// Maximum number of times the tool can be used in the API request.
 14844  	MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
 14845  	// If true, tool will not be included in initial system prompt. Only loaded when
 14846  	// returned via tool_reference from tool search.
 14847  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 14848  	// When true, guarantees schema validation on tool names and inputs
 14849  	Strict param.Opt[bool] `json:"strict,omitzero"`
 14850  	// List of domains to allow fetching from
 14851  	AllowedDomains []string `json:"allowed_domains,omitzero"`
 14852  	// List of domains to block fetching from
 14853  	BlockedDomains []string `json:"blocked_domains,omitzero"`
 14854  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 14855  	// "code_execution_20260521".
 14856  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 14857  	// Create a cache control breakpoint at this content block.
 14858  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 14859  	// Citations configuration for fetched documents. Citations are disabled by
 14860  	// default.
 14861  	Citations BetaCitationsConfigParam `json:"citations,omitzero"`
 14862  	// Name of the tool.
 14863  	//
 14864  	// This is how the tool will be called by the model and in `tool_use` blocks.
 14865  	//
 14866  	// This field can be elided, and will marshal its zero value as "web_fetch".
 14867  	Name constant.WebFetch `json:"name" default:"web_fetch"`
 14868  	// This field can be elided, and will marshal its zero value as
 14869  	// "web_fetch_20260209".
 14870  	Type constant.WebFetch20260209 `json:"type" default:"web_fetch_20260209"`
 14871  	paramObj
 14872  }
 14873  
 14874  func (r BetaWebFetchTool20260209Param) MarshalJSON() (data []byte, err error) {
 14875  	type shadow BetaWebFetchTool20260209Param
 14876  	return param.MarshalObject(r, (*shadow)(&r))
 14877  }
 14878  func (r *BetaWebFetchTool20260209Param) UnmarshalJSON(data []byte) error {
 14879  	return apijson.UnmarshalRoot(data, r)
 14880  }
 14881  
 14882  // Web fetch tool with use_cache parameter for bypassing cached content.
 14883  //
 14884  // The properties Name, Type are required.
 14885  type BetaWebFetchTool20260309Param struct {
 14886  	// Maximum number of tokens used by including web page text content in the context.
 14887  	// The limit is approximate and does not apply to binary content such as PDFs.
 14888  	MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
 14889  	// Maximum number of times the tool can be used in the API request.
 14890  	MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
 14891  	// If true, tool will not be included in initial system prompt. Only loaded when
 14892  	// returned via tool_reference from tool search.
 14893  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 14894  	// When true, guarantees schema validation on tool names and inputs
 14895  	Strict param.Opt[bool] `json:"strict,omitzero"`
 14896  	// Whether to use cached content. Set to false to bypass the cache and fetch fresh
 14897  	// content. Only set to false when the user explicitly requests fresh content or
 14898  	// when fetching rapidly-changing sources.
 14899  	UseCache param.Opt[bool] `json:"use_cache,omitzero"`
 14900  	// List of domains to allow fetching from
 14901  	AllowedDomains []string `json:"allowed_domains,omitzero"`
 14902  	// List of domains to block fetching from
 14903  	BlockedDomains []string `json:"blocked_domains,omitzero"`
 14904  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 14905  	// "code_execution_20260521".
 14906  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 14907  	// Create a cache control breakpoint at this content block.
 14908  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 14909  	// Citations configuration for fetched documents. Citations are disabled by
 14910  	// default.
 14911  	Citations BetaCitationsConfigParam `json:"citations,omitzero"`
 14912  	// Name of the tool.
 14913  	//
 14914  	// This is how the tool will be called by the model and in `tool_use` blocks.
 14915  	//
 14916  	// This field can be elided, and will marshal its zero value as "web_fetch".
 14917  	Name constant.WebFetch `json:"name" default:"web_fetch"`
 14918  	// This field can be elided, and will marshal its zero value as
 14919  	// "web_fetch_20260309".
 14920  	Type constant.WebFetch20260309 `json:"type" default:"web_fetch_20260309"`
 14921  	paramObj
 14922  }
 14923  
 14924  func (r BetaWebFetchTool20260309Param) MarshalJSON() (data []byte, err error) {
 14925  	type shadow BetaWebFetchTool20260309Param
 14926  	return param.MarshalObject(r, (*shadow)(&r))
 14927  }
 14928  func (r *BetaWebFetchTool20260309Param) UnmarshalJSON(data []byte) error {
 14929  	return apijson.UnmarshalRoot(data, r)
 14930  }
 14931  
 14932  // The properties Name, Type are required.
 14933  type BetaWebFetchTool20260318Param struct {
 14934  	// Maximum number of tokens used by including web page text content in the context.
 14935  	// The limit is approximate and does not apply to binary content such as PDFs.
 14936  	MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
 14937  	// Maximum number of times the tool can be used in the API request.
 14938  	MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
 14939  	// If true, tool will not be included in initial system prompt. Only loaded when
 14940  	// returned via tool_reference from tool search.
 14941  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 14942  	// When true, guarantees schema validation on tool names and inputs
 14943  	Strict param.Opt[bool] `json:"strict,omitzero"`
 14944  	// Whether to use cached content. Set to false to bypass the cache and fetch fresh
 14945  	// content. Only set to false when the user explicitly requests fresh content or
 14946  	// when fetching rapidly-changing sources.
 14947  	UseCache param.Opt[bool] `json:"use_cache,omitzero"`
 14948  	// List of domains to allow fetching from
 14949  	AllowedDomains []string `json:"allowed_domains,omitzero"`
 14950  	// List of domains to block fetching from
 14951  	BlockedDomains []string `json:"blocked_domains,omitzero"`
 14952  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 14953  	// "code_execution_20260521".
 14954  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 14955  	// Create a cache control breakpoint at this content block.
 14956  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 14957  	// Citations configuration for fetched documents. Citations are disabled by
 14958  	// default.
 14959  	Citations BetaCitationsConfigParam `json:"citations,omitzero"`
 14960  	// How this tool's result blocks appear in the API response when the result was
 14961  	// consumed by a completed code_execution call in the same turn. 'full' returns the
 14962  	// complete content (default). 'excluded' drops the nested server_tool_use and
 14963  	// result block pair entirely. Results from direct calls, or from code_execution
 14964  	// calls that paused before completing, are always returned in full so they can be
 14965  	// sent back on the next turn.
 14966  	//
 14967  	// Any of "full", "excluded".
 14968  	ResponseInclusion BetaWebFetchTool20260318ResponseInclusion `json:"response_inclusion,omitzero"`
 14969  	// Name of the tool.
 14970  	//
 14971  	// This is how the tool will be called by the model and in `tool_use` blocks.
 14972  	//
 14973  	// This field can be elided, and will marshal its zero value as "web_fetch".
 14974  	Name constant.WebFetch `json:"name" default:"web_fetch"`
 14975  	// This field can be elided, and will marshal its zero value as
 14976  	// "web_fetch_20260318".
 14977  	Type constant.WebFetch20260318 `json:"type" default:"web_fetch_20260318"`
 14978  	paramObj
 14979  }
 14980  
 14981  func (r BetaWebFetchTool20260318Param) MarshalJSON() (data []byte, err error) {
 14982  	type shadow BetaWebFetchTool20260318Param
 14983  	return param.MarshalObject(r, (*shadow)(&r))
 14984  }
 14985  func (r *BetaWebFetchTool20260318Param) UnmarshalJSON(data []byte) error {
 14986  	return apijson.UnmarshalRoot(data, r)
 14987  }
 14988  
 14989  // How this tool's result blocks appear in the API response when the result was
 14990  // consumed by a completed code_execution call in the same turn. 'full' returns the
 14991  // complete content (default). 'excluded' drops the nested server_tool_use and
 14992  // result block pair entirely. Results from direct calls, or from code_execution
 14993  // calls that paused before completing, are always returned in full so they can be
 14994  // sent back on the next turn.
 14995  type BetaWebFetchTool20260318ResponseInclusion string
 14996  
 14997  const (
 14998  	BetaWebFetchTool20260318ResponseInclusionFull     BetaWebFetchTool20260318ResponseInclusion = "full"
 14999  	BetaWebFetchTool20260318ResponseInclusionExcluded BetaWebFetchTool20260318ResponseInclusion = "excluded"
 15000  )
 15001  
 15002  type BetaWebFetchToolResultBlock struct {
 15003  	Content   BetaWebFetchToolResultBlockContentUnion `json:"content" api:"required"`
 15004  	ToolUseID string                                  `json:"tool_use_id" api:"required"`
 15005  	Type      constant.WebFetchToolResult             `json:"type" default:"web_fetch_tool_result"`
 15006  	// Tool invocation directly from the model.
 15007  	Caller BetaWebFetchToolResultBlockCallerUnion `json:"caller"`
 15008  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 15009  	JSON struct {
 15010  		Content     respjson.Field
 15011  		ToolUseID   respjson.Field
 15012  		Type        respjson.Field
 15013  		Caller      respjson.Field
 15014  		ExtraFields map[string]respjson.Field
 15015  		raw         string
 15016  	} `json:"-"`
 15017  }
 15018  
 15019  // Returns the unmodified JSON received from the API
 15020  func (r BetaWebFetchToolResultBlock) RawJSON() string { return r.JSON.raw }
 15021  func (r *BetaWebFetchToolResultBlock) UnmarshalJSON(data []byte) error {
 15022  	return apijson.UnmarshalRoot(data, r)
 15023  }
 15024  
 15025  // BetaWebFetchToolResultBlockContentUnion contains all possible properties and
 15026  // values from [BetaWebFetchToolResultErrorBlock], [BetaWebFetchBlock].
 15027  //
 15028  // Use the methods beginning with 'As' to cast the union to one of its variants.
 15029  type BetaWebFetchToolResultBlockContentUnion struct {
 15030  	// This field is from variant [BetaWebFetchToolResultErrorBlock].
 15031  	ErrorCode BetaWebFetchToolResultErrorCode `json:"error_code"`
 15032  	Type      string                          `json:"type"`
 15033  	// This field is from variant [BetaWebFetchBlock].
 15034  	Content BetaDocumentBlock `json:"content"`
 15035  	// This field is from variant [BetaWebFetchBlock].
 15036  	RetrievedAt string `json:"retrieved_at"`
 15037  	// This field is from variant [BetaWebFetchBlock].
 15038  	URL  string `json:"url"`
 15039  	JSON struct {
 15040  		ErrorCode   respjson.Field
 15041  		Type        respjson.Field
 15042  		Content     respjson.Field
 15043  		RetrievedAt respjson.Field
 15044  		URL         respjson.Field
 15045  		raw         string
 15046  	} `json:"-"`
 15047  }
 15048  
 15049  func (u BetaWebFetchToolResultBlockContentUnion) AsResponseWebFetchToolResultError() (v BetaWebFetchToolResultErrorBlock) {
 15050  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15051  	return
 15052  }
 15053  
 15054  func (u BetaWebFetchToolResultBlockContentUnion) AsResponseWebFetchResultBlock() (v BetaWebFetchBlock) {
 15055  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15056  	return
 15057  }
 15058  
 15059  // Returns the unmodified JSON received from the API
 15060  func (u BetaWebFetchToolResultBlockContentUnion) RawJSON() string { return u.JSON.raw }
 15061  
 15062  func (r *BetaWebFetchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error {
 15063  	return apijson.UnmarshalRoot(data, r)
 15064  }
 15065  
 15066  // BetaWebFetchToolResultBlockCallerUnion contains all possible properties and
 15067  // values from [BetaDirectCaller], [BetaServerToolCaller],
 15068  // [BetaServerToolCaller20260120].
 15069  //
 15070  // Use the [BetaWebFetchToolResultBlockCallerUnion.AsAny] method to switch on the
 15071  // variant.
 15072  //
 15073  // Use the methods beginning with 'As' to cast the union to one of its variants.
 15074  type BetaWebFetchToolResultBlockCallerUnion struct {
 15075  	// Any of "direct", "code_execution_20250825", "code_execution_20260120".
 15076  	Type   string `json:"type"`
 15077  	ToolID string `json:"tool_id"`
 15078  	JSON   struct {
 15079  		Type   respjson.Field
 15080  		ToolID respjson.Field
 15081  		raw    string
 15082  	} `json:"-"`
 15083  }
 15084  
 15085  // anyBetaWebFetchToolResultBlockCaller is implemented by each variant of
 15086  // [BetaWebFetchToolResultBlockCallerUnion] to add type safety for the return type
 15087  // of [BetaWebFetchToolResultBlockCallerUnion.AsAny]
 15088  type anyBetaWebFetchToolResultBlockCaller interface {
 15089  	implBetaWebFetchToolResultBlockCallerUnion()
 15090  }
 15091  
 15092  func (BetaDirectCaller) implBetaWebFetchToolResultBlockCallerUnion()             {}
 15093  func (BetaServerToolCaller) implBetaWebFetchToolResultBlockCallerUnion()         {}
 15094  func (BetaServerToolCaller20260120) implBetaWebFetchToolResultBlockCallerUnion() {}
 15095  
 15096  // Use the following switch statement to find the correct variant
 15097  //
 15098  //	switch variant := BetaWebFetchToolResultBlockCallerUnion.AsAny().(type) {
 15099  //	case anthropic.BetaDirectCaller:
 15100  //	case anthropic.BetaServerToolCaller:
 15101  //	case anthropic.BetaServerToolCaller20260120:
 15102  //	default:
 15103  //	  fmt.Errorf("no variant present")
 15104  //	}
 15105  func (u BetaWebFetchToolResultBlockCallerUnion) AsAny() anyBetaWebFetchToolResultBlockCaller {
 15106  	switch u.Type {
 15107  	case "direct":
 15108  		return u.AsDirect()
 15109  	case "code_execution_20250825":
 15110  		return u.AsCodeExecution20250825()
 15111  	case "code_execution_20260120":
 15112  		return u.AsCodeExecution20260120()
 15113  	}
 15114  	return nil
 15115  }
 15116  
 15117  func (u BetaWebFetchToolResultBlockCallerUnion) AsDirect() (v BetaDirectCaller) {
 15118  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15119  	return
 15120  }
 15121  
 15122  func (u BetaWebFetchToolResultBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller) {
 15123  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15124  	return
 15125  }
 15126  
 15127  func (u BetaWebFetchToolResultBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120) {
 15128  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15129  	return
 15130  }
 15131  
 15132  // Returns the unmodified JSON received from the API
 15133  func (u BetaWebFetchToolResultBlockCallerUnion) RawJSON() string { return u.JSON.raw }
 15134  
 15135  func (r *BetaWebFetchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error {
 15136  	return apijson.UnmarshalRoot(data, r)
 15137  }
 15138  
 15139  // The properties Content, ToolUseID, Type are required.
 15140  type BetaWebFetchToolResultBlockParam struct {
 15141  	Content   BetaWebFetchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
 15142  	ToolUseID string                                       `json:"tool_use_id" api:"required"`
 15143  	// Create a cache control breakpoint at this content block.
 15144  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 15145  	// Tool invocation directly from the model.
 15146  	Caller BetaWebFetchToolResultBlockParamCallerUnion `json:"caller,omitzero"`
 15147  	// This field can be elided, and will marshal its zero value as
 15148  	// "web_fetch_tool_result".
 15149  	Type constant.WebFetchToolResult `json:"type" default:"web_fetch_tool_result"`
 15150  	paramObj
 15151  }
 15152  
 15153  func (r BetaWebFetchToolResultBlockParam) MarshalJSON() (data []byte, err error) {
 15154  	type shadow BetaWebFetchToolResultBlockParam
 15155  	return param.MarshalObject(r, (*shadow)(&r))
 15156  }
 15157  func (r *BetaWebFetchToolResultBlockParam) UnmarshalJSON(data []byte) error {
 15158  	return apijson.UnmarshalRoot(data, r)
 15159  }
 15160  
 15161  // Only one field can be non-zero.
 15162  //
 15163  // Use [param.IsOmitted] to confirm if a field is set.
 15164  type BetaWebFetchToolResultBlockParamContentUnion struct {
 15165  	OfRequestWebFetchToolResultError *BetaWebFetchToolResultErrorBlockParam `json:",omitzero,inline"`
 15166  	OfRequestWebFetchResultBlock     *BetaWebFetchBlockParam                `json:",omitzero,inline"`
 15167  	paramUnion
 15168  }
 15169  
 15170  func (u BetaWebFetchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
 15171  	return param.MarshalUnion(u, u.OfRequestWebFetchToolResultError, u.OfRequestWebFetchResultBlock)
 15172  }
 15173  func (u *BetaWebFetchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
 15174  	return apijson.UnmarshalRoot(data, u)
 15175  }
 15176  
 15177  func (u *BetaWebFetchToolResultBlockParamContentUnion) asAny() any {
 15178  	if !param.IsOmitted(u.OfRequestWebFetchToolResultError) {
 15179  		return u.OfRequestWebFetchToolResultError
 15180  	} else if !param.IsOmitted(u.OfRequestWebFetchResultBlock) {
 15181  		return u.OfRequestWebFetchResultBlock
 15182  	}
 15183  	return nil
 15184  }
 15185  
 15186  // Returns a pointer to the underlying variant's property, if present.
 15187  func (u BetaWebFetchToolResultBlockParamContentUnion) GetErrorCode() *string {
 15188  	if vt := u.OfRequestWebFetchToolResultError; vt != nil {
 15189  		return (*string)(&vt.ErrorCode)
 15190  	}
 15191  	return nil
 15192  }
 15193  
 15194  // Returns a pointer to the underlying variant's property, if present.
 15195  func (u BetaWebFetchToolResultBlockParamContentUnion) GetContent() *BetaRequestDocumentBlockParam {
 15196  	if vt := u.OfRequestWebFetchResultBlock; vt != nil {
 15197  		return &vt.Content
 15198  	}
 15199  	return nil
 15200  }
 15201  
 15202  // Returns a pointer to the underlying variant's property, if present.
 15203  func (u BetaWebFetchToolResultBlockParamContentUnion) GetURL() *string {
 15204  	if vt := u.OfRequestWebFetchResultBlock; vt != nil {
 15205  		return &vt.URL
 15206  	}
 15207  	return nil
 15208  }
 15209  
 15210  // Returns a pointer to the underlying variant's property, if present.
 15211  func (u BetaWebFetchToolResultBlockParamContentUnion) GetRetrievedAt() *string {
 15212  	if vt := u.OfRequestWebFetchResultBlock; vt != nil && vt.RetrievedAt.Valid() {
 15213  		return &vt.RetrievedAt.Value
 15214  	}
 15215  	return nil
 15216  }
 15217  
 15218  // Returns a pointer to the underlying variant's property, if present.
 15219  func (u BetaWebFetchToolResultBlockParamContentUnion) GetType() *string {
 15220  	if vt := u.OfRequestWebFetchToolResultError; vt != nil {
 15221  		return (*string)(&vt.Type)
 15222  	} else if vt := u.OfRequestWebFetchResultBlock; vt != nil {
 15223  		return (*string)(&vt.Type)
 15224  	}
 15225  	return nil
 15226  }
 15227  
 15228  // Only one field can be non-zero.
 15229  //
 15230  // Use [param.IsOmitted] to confirm if a field is set.
 15231  type BetaWebFetchToolResultBlockParamCallerUnion struct {
 15232  	OfDirect                *BetaDirectCallerParam             `json:",omitzero,inline"`
 15233  	OfCodeExecution20250825 *BetaServerToolCallerParam         `json:",omitzero,inline"`
 15234  	OfCodeExecution20260120 *BetaServerToolCaller20260120Param `json:",omitzero,inline"`
 15235  	paramUnion
 15236  }
 15237  
 15238  func (u BetaWebFetchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error) {
 15239  	return param.MarshalUnion(u, u.OfDirect, u.OfCodeExecution20250825, u.OfCodeExecution20260120)
 15240  }
 15241  func (u *BetaWebFetchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error {
 15242  	return apijson.UnmarshalRoot(data, u)
 15243  }
 15244  
 15245  func (u *BetaWebFetchToolResultBlockParamCallerUnion) asAny() any {
 15246  	if !param.IsOmitted(u.OfDirect) {
 15247  		return u.OfDirect
 15248  	} else if !param.IsOmitted(u.OfCodeExecution20250825) {
 15249  		return u.OfCodeExecution20250825
 15250  	} else if !param.IsOmitted(u.OfCodeExecution20260120) {
 15251  		return u.OfCodeExecution20260120
 15252  	}
 15253  	return nil
 15254  }
 15255  
 15256  // Returns a pointer to the underlying variant's property, if present.
 15257  func (u BetaWebFetchToolResultBlockParamCallerUnion) GetType() *string {
 15258  	if vt := u.OfDirect; vt != nil {
 15259  		return (*string)(&vt.Type)
 15260  	} else if vt := u.OfCodeExecution20250825; vt != nil {
 15261  		return (*string)(&vt.Type)
 15262  	} else if vt := u.OfCodeExecution20260120; vt != nil {
 15263  		return (*string)(&vt.Type)
 15264  	}
 15265  	return nil
 15266  }
 15267  
 15268  // Returns a pointer to the underlying variant's property, if present.
 15269  func (u BetaWebFetchToolResultBlockParamCallerUnion) GetToolID() *string {
 15270  	if vt := u.OfCodeExecution20250825; vt != nil {
 15271  		return (*string)(&vt.ToolID)
 15272  	} else if vt := u.OfCodeExecution20260120; vt != nil {
 15273  		return (*string)(&vt.ToolID)
 15274  	}
 15275  	return nil
 15276  }
 15277  
 15278  func init() {
 15279  	apijson.RegisterUnion[BetaWebFetchToolResultBlockParamCallerUnion](
 15280  		"type",
 15281  		apijson.Discriminator[BetaDirectCallerParam]("direct"),
 15282  		apijson.Discriminator[BetaServerToolCallerParam]("code_execution_20250825"),
 15283  		apijson.Discriminator[BetaServerToolCaller20260120Param]("code_execution_20260120"),
 15284  	)
 15285  }
 15286  
 15287  type BetaWebFetchToolResultErrorBlock struct {
 15288  	// Any of "invalid_tool_input", "url_too_long", "url_not_allowed",
 15289  	// "url_not_in_prior_context", "url_not_accessible", "unsupported_content_type",
 15290  	// "too_many_requests", "max_uses_exceeded", "unavailable".
 15291  	ErrorCode BetaWebFetchToolResultErrorCode  `json:"error_code" api:"required"`
 15292  	Type      constant.WebFetchToolResultError `json:"type" default:"web_fetch_tool_result_error"`
 15293  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 15294  	JSON struct {
 15295  		ErrorCode   respjson.Field
 15296  		Type        respjson.Field
 15297  		ExtraFields map[string]respjson.Field
 15298  		raw         string
 15299  	} `json:"-"`
 15300  }
 15301  
 15302  // Returns the unmodified JSON received from the API
 15303  func (r BetaWebFetchToolResultErrorBlock) RawJSON() string { return r.JSON.raw }
 15304  func (r *BetaWebFetchToolResultErrorBlock) UnmarshalJSON(data []byte) error {
 15305  	return apijson.UnmarshalRoot(data, r)
 15306  }
 15307  
 15308  // The properties ErrorCode, Type are required.
 15309  type BetaWebFetchToolResultErrorBlockParam struct {
 15310  	// Any of "invalid_tool_input", "url_too_long", "url_not_allowed",
 15311  	// "url_not_in_prior_context", "url_not_accessible", "unsupported_content_type",
 15312  	// "too_many_requests", "max_uses_exceeded", "unavailable".
 15313  	ErrorCode BetaWebFetchToolResultErrorCode `json:"error_code,omitzero" api:"required"`
 15314  	// This field can be elided, and will marshal its zero value as
 15315  	// "web_fetch_tool_result_error".
 15316  	Type constant.WebFetchToolResultError `json:"type" default:"web_fetch_tool_result_error"`
 15317  	paramObj
 15318  }
 15319  
 15320  func (r BetaWebFetchToolResultErrorBlockParam) MarshalJSON() (data []byte, err error) {
 15321  	type shadow BetaWebFetchToolResultErrorBlockParam
 15322  	return param.MarshalObject(r, (*shadow)(&r))
 15323  }
 15324  func (r *BetaWebFetchToolResultErrorBlockParam) UnmarshalJSON(data []byte) error {
 15325  	return apijson.UnmarshalRoot(data, r)
 15326  }
 15327  
 15328  type BetaWebFetchToolResultErrorCode string
 15329  
 15330  const (
 15331  	BetaWebFetchToolResultErrorCodeInvalidToolInput       BetaWebFetchToolResultErrorCode = "invalid_tool_input"
 15332  	BetaWebFetchToolResultErrorCodeURLTooLong             BetaWebFetchToolResultErrorCode = "url_too_long"
 15333  	BetaWebFetchToolResultErrorCodeURLNotAllowed          BetaWebFetchToolResultErrorCode = "url_not_allowed"
 15334  	BetaWebFetchToolResultErrorCodeURLNotInPriorContext   BetaWebFetchToolResultErrorCode = "url_not_in_prior_context"
 15335  	BetaWebFetchToolResultErrorCodeURLNotAccessible       BetaWebFetchToolResultErrorCode = "url_not_accessible"
 15336  	BetaWebFetchToolResultErrorCodeUnsupportedContentType BetaWebFetchToolResultErrorCode = "unsupported_content_type"
 15337  	BetaWebFetchToolResultErrorCodeTooManyRequests        BetaWebFetchToolResultErrorCode = "too_many_requests"
 15338  	BetaWebFetchToolResultErrorCodeMaxUsesExceeded        BetaWebFetchToolResultErrorCode = "max_uses_exceeded"
 15339  	BetaWebFetchToolResultErrorCodeUnavailable            BetaWebFetchToolResultErrorCode = "unavailable"
 15340  )
 15341  
 15342  type BetaWebSearchResultBlock struct {
 15343  	EncryptedContent string                   `json:"encrypted_content" api:"required"`
 15344  	PageAge          string                   `json:"page_age" api:"required"`
 15345  	Title            string                   `json:"title" api:"required"`
 15346  	Type             constant.WebSearchResult `json:"type" default:"web_search_result"`
 15347  	URL              string                   `json:"url" api:"required"`
 15348  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 15349  	JSON struct {
 15350  		EncryptedContent respjson.Field
 15351  		PageAge          respjson.Field
 15352  		Title            respjson.Field
 15353  		Type             respjson.Field
 15354  		URL              respjson.Field
 15355  		ExtraFields      map[string]respjson.Field
 15356  		raw              string
 15357  	} `json:"-"`
 15358  }
 15359  
 15360  // Returns the unmodified JSON received from the API
 15361  func (r BetaWebSearchResultBlock) RawJSON() string { return r.JSON.raw }
 15362  func (r *BetaWebSearchResultBlock) UnmarshalJSON(data []byte) error {
 15363  	return apijson.UnmarshalRoot(data, r)
 15364  }
 15365  
 15366  // The properties EncryptedContent, Title, Type, URL are required.
 15367  type BetaWebSearchResultBlockParam struct {
 15368  	EncryptedContent string            `json:"encrypted_content" api:"required"`
 15369  	Title            string            `json:"title" api:"required"`
 15370  	URL              string            `json:"url" api:"required"`
 15371  	PageAge          param.Opt[string] `json:"page_age,omitzero"`
 15372  	// This field can be elided, and will marshal its zero value as
 15373  	// "web_search_result".
 15374  	Type constant.WebSearchResult `json:"type" default:"web_search_result"`
 15375  	paramObj
 15376  }
 15377  
 15378  func (r BetaWebSearchResultBlockParam) MarshalJSON() (data []byte, err error) {
 15379  	type shadow BetaWebSearchResultBlockParam
 15380  	return param.MarshalObject(r, (*shadow)(&r))
 15381  }
 15382  func (r *BetaWebSearchResultBlockParam) UnmarshalJSON(data []byte) error {
 15383  	return apijson.UnmarshalRoot(data, r)
 15384  }
 15385  
 15386  // The properties Name, Type are required.
 15387  type BetaWebSearchTool20250305Param struct {
 15388  	// Maximum number of times the tool can be used in the API request.
 15389  	MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
 15390  	// If true, tool will not be included in initial system prompt. Only loaded when
 15391  	// returned via tool_reference from tool search.
 15392  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 15393  	// When true, guarantees schema validation on tool names and inputs
 15394  	Strict param.Opt[bool] `json:"strict,omitzero"`
 15395  	// If provided, only these domains will be included in results. Cannot be used
 15396  	// alongside `blocked_domains`.
 15397  	AllowedDomains []string `json:"allowed_domains,omitzero"`
 15398  	// If provided, these domains will never appear in results. Cannot be used
 15399  	// alongside `allowed_domains`.
 15400  	BlockedDomains []string `json:"blocked_domains,omitzero"`
 15401  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 15402  	// "code_execution_20260521".
 15403  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 15404  	// Create a cache control breakpoint at this content block.
 15405  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 15406  	// Parameters for the user's location. Used to provide more relevant search
 15407  	// results.
 15408  	UserLocation BetaUserLocationParam `json:"user_location,omitzero"`
 15409  	// Name of the tool.
 15410  	//
 15411  	// This is how the tool will be called by the model and in `tool_use` blocks.
 15412  	//
 15413  	// This field can be elided, and will marshal its zero value as "web_search".
 15414  	Name constant.WebSearch `json:"name" default:"web_search"`
 15415  	// This field can be elided, and will marshal its zero value as
 15416  	// "web_search_20250305".
 15417  	Type constant.WebSearch20250305 `json:"type" default:"web_search_20250305"`
 15418  	paramObj
 15419  }
 15420  
 15421  func (r BetaWebSearchTool20250305Param) MarshalJSON() (data []byte, err error) {
 15422  	type shadow BetaWebSearchTool20250305Param
 15423  	return param.MarshalObject(r, (*shadow)(&r))
 15424  }
 15425  func (r *BetaWebSearchTool20250305Param) UnmarshalJSON(data []byte) error {
 15426  	return apijson.UnmarshalRoot(data, r)
 15427  }
 15428  
 15429  // The properties Name, Type are required.
 15430  type BetaWebSearchTool20260209Param struct {
 15431  	// Maximum number of times the tool can be used in the API request.
 15432  	MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
 15433  	// If true, tool will not be included in initial system prompt. Only loaded when
 15434  	// returned via tool_reference from tool search.
 15435  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 15436  	// When true, guarantees schema validation on tool names and inputs
 15437  	Strict param.Opt[bool] `json:"strict,omitzero"`
 15438  	// If provided, only these domains will be included in results. Cannot be used
 15439  	// alongside `blocked_domains`.
 15440  	AllowedDomains []string `json:"allowed_domains,omitzero"`
 15441  	// If provided, these domains will never appear in results. Cannot be used
 15442  	// alongside `allowed_domains`.
 15443  	BlockedDomains []string `json:"blocked_domains,omitzero"`
 15444  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 15445  	// "code_execution_20260521".
 15446  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 15447  	// Create a cache control breakpoint at this content block.
 15448  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 15449  	// Parameters for the user's location. Used to provide more relevant search
 15450  	// results.
 15451  	UserLocation BetaUserLocationParam `json:"user_location,omitzero"`
 15452  	// Name of the tool.
 15453  	//
 15454  	// This is how the tool will be called by the model and in `tool_use` blocks.
 15455  	//
 15456  	// This field can be elided, and will marshal its zero value as "web_search".
 15457  	Name constant.WebSearch `json:"name" default:"web_search"`
 15458  	// This field can be elided, and will marshal its zero value as
 15459  	// "web_search_20260209".
 15460  	Type constant.WebSearch20260209 `json:"type" default:"web_search_20260209"`
 15461  	paramObj
 15462  }
 15463  
 15464  func (r BetaWebSearchTool20260209Param) MarshalJSON() (data []byte, err error) {
 15465  	type shadow BetaWebSearchTool20260209Param
 15466  	return param.MarshalObject(r, (*shadow)(&r))
 15467  }
 15468  func (r *BetaWebSearchTool20260209Param) UnmarshalJSON(data []byte) error {
 15469  	return apijson.UnmarshalRoot(data, r)
 15470  }
 15471  
 15472  // The properties Name, Type are required.
 15473  type BetaWebSearchTool20260318Param struct {
 15474  	// Maximum number of times the tool can be used in the API request.
 15475  	MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
 15476  	// If true, tool will not be included in initial system prompt. Only loaded when
 15477  	// returned via tool_reference from tool search.
 15478  	DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
 15479  	// When true, guarantees schema validation on tool names and inputs
 15480  	Strict param.Opt[bool] `json:"strict,omitzero"`
 15481  	// If provided, only these domains will be included in results. Cannot be used
 15482  	// alongside `blocked_domains`.
 15483  	AllowedDomains []string `json:"allowed_domains,omitzero"`
 15484  	// If provided, these domains will never appear in results. Cannot be used
 15485  	// alongside `allowed_domains`.
 15486  	BlockedDomains []string `json:"blocked_domains,omitzero"`
 15487  	// Any of "direct", "code_execution_20250825", "code_execution_20260120",
 15488  	// "code_execution_20260521".
 15489  	AllowedCallers []string `json:"allowed_callers,omitzero"`
 15490  	// Create a cache control breakpoint at this content block.
 15491  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 15492  	// How this tool's result blocks appear in the API response when the result was
 15493  	// consumed by a completed code_execution call in the same turn. 'full' returns the
 15494  	// complete content (default). 'excluded' drops the nested server_tool_use and
 15495  	// result block pair entirely. Results from direct calls, or from code_execution
 15496  	// calls that paused before completing, are always returned in full so they can be
 15497  	// sent back on the next turn.
 15498  	//
 15499  	// Any of "full", "excluded".
 15500  	ResponseInclusion BetaWebSearchTool20260318ResponseInclusion `json:"response_inclusion,omitzero"`
 15501  	// Parameters for the user's location. Used to provide more relevant search
 15502  	// results.
 15503  	UserLocation BetaUserLocationParam `json:"user_location,omitzero"`
 15504  	// Name of the tool.
 15505  	//
 15506  	// This is how the tool will be called by the model and in `tool_use` blocks.
 15507  	//
 15508  	// This field can be elided, and will marshal its zero value as "web_search".
 15509  	Name constant.WebSearch `json:"name" default:"web_search"`
 15510  	// This field can be elided, and will marshal its zero value as
 15511  	// "web_search_20260318".
 15512  	Type constant.WebSearch20260318 `json:"type" default:"web_search_20260318"`
 15513  	paramObj
 15514  }
 15515  
 15516  func (r BetaWebSearchTool20260318Param) MarshalJSON() (data []byte, err error) {
 15517  	type shadow BetaWebSearchTool20260318Param
 15518  	return param.MarshalObject(r, (*shadow)(&r))
 15519  }
 15520  func (r *BetaWebSearchTool20260318Param) UnmarshalJSON(data []byte) error {
 15521  	return apijson.UnmarshalRoot(data, r)
 15522  }
 15523  
 15524  // How this tool's result blocks appear in the API response when the result was
 15525  // consumed by a completed code_execution call in the same turn. 'full' returns the
 15526  // complete content (default). 'excluded' drops the nested server_tool_use and
 15527  // result block pair entirely. Results from direct calls, or from code_execution
 15528  // calls that paused before completing, are always returned in full so they can be
 15529  // sent back on the next turn.
 15530  type BetaWebSearchTool20260318ResponseInclusion string
 15531  
 15532  const (
 15533  	BetaWebSearchTool20260318ResponseInclusionFull     BetaWebSearchTool20260318ResponseInclusion = "full"
 15534  	BetaWebSearchTool20260318ResponseInclusionExcluded BetaWebSearchTool20260318ResponseInclusion = "excluded"
 15535  )
 15536  
 15537  // The properties ErrorCode, Type are required.
 15538  type BetaWebSearchToolRequestErrorParam struct {
 15539  	// Any of "invalid_tool_input", "unavailable", "max_uses_exceeded",
 15540  	// "too_many_requests", "query_too_long", "request_too_large".
 15541  	ErrorCode BetaWebSearchToolResultErrorCode `json:"error_code,omitzero" api:"required"`
 15542  	// This field can be elided, and will marshal its zero value as
 15543  	// "web_search_tool_result_error".
 15544  	Type constant.WebSearchToolResultError `json:"type" default:"web_search_tool_result_error"`
 15545  	paramObj
 15546  }
 15547  
 15548  func (r BetaWebSearchToolRequestErrorParam) MarshalJSON() (data []byte, err error) {
 15549  	type shadow BetaWebSearchToolRequestErrorParam
 15550  	return param.MarshalObject(r, (*shadow)(&r))
 15551  }
 15552  func (r *BetaWebSearchToolRequestErrorParam) UnmarshalJSON(data []byte) error {
 15553  	return apijson.UnmarshalRoot(data, r)
 15554  }
 15555  
 15556  type BetaWebSearchToolResultBlock struct {
 15557  	Content   BetaWebSearchToolResultBlockContentUnion `json:"content" api:"required"`
 15558  	ToolUseID string                                   `json:"tool_use_id" api:"required"`
 15559  	Type      constant.WebSearchToolResult             `json:"type" default:"web_search_tool_result"`
 15560  	// Tool invocation directly from the model.
 15561  	Caller BetaWebSearchToolResultBlockCallerUnion `json:"caller"`
 15562  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 15563  	JSON struct {
 15564  		Content     respjson.Field
 15565  		ToolUseID   respjson.Field
 15566  		Type        respjson.Field
 15567  		Caller      respjson.Field
 15568  		ExtraFields map[string]respjson.Field
 15569  		raw         string
 15570  	} `json:"-"`
 15571  }
 15572  
 15573  // Returns the unmodified JSON received from the API
 15574  func (r BetaWebSearchToolResultBlock) RawJSON() string { return r.JSON.raw }
 15575  func (r *BetaWebSearchToolResultBlock) UnmarshalJSON(data []byte) error {
 15576  	return apijson.UnmarshalRoot(data, r)
 15577  }
 15578  
 15579  // BetaWebSearchToolResultBlockCallerUnion contains all possible properties and
 15580  // values from [BetaDirectCaller], [BetaServerToolCaller],
 15581  // [BetaServerToolCaller20260120].
 15582  //
 15583  // Use the [BetaWebSearchToolResultBlockCallerUnion.AsAny] method to switch on the
 15584  // variant.
 15585  //
 15586  // Use the methods beginning with 'As' to cast the union to one of its variants.
 15587  type BetaWebSearchToolResultBlockCallerUnion struct {
 15588  	// Any of "direct", "code_execution_20250825", "code_execution_20260120".
 15589  	Type   string `json:"type"`
 15590  	ToolID string `json:"tool_id"`
 15591  	JSON   struct {
 15592  		Type   respjson.Field
 15593  		ToolID respjson.Field
 15594  		raw    string
 15595  	} `json:"-"`
 15596  }
 15597  
 15598  // anyBetaWebSearchToolResultBlockCaller is implemented by each variant of
 15599  // [BetaWebSearchToolResultBlockCallerUnion] to add type safety for the return type
 15600  // of [BetaWebSearchToolResultBlockCallerUnion.AsAny]
 15601  type anyBetaWebSearchToolResultBlockCaller interface {
 15602  	implBetaWebSearchToolResultBlockCallerUnion()
 15603  }
 15604  
 15605  func (BetaDirectCaller) implBetaWebSearchToolResultBlockCallerUnion()             {}
 15606  func (BetaServerToolCaller) implBetaWebSearchToolResultBlockCallerUnion()         {}
 15607  func (BetaServerToolCaller20260120) implBetaWebSearchToolResultBlockCallerUnion() {}
 15608  
 15609  // Use the following switch statement to find the correct variant
 15610  //
 15611  //	switch variant := BetaWebSearchToolResultBlockCallerUnion.AsAny().(type) {
 15612  //	case anthropic.BetaDirectCaller:
 15613  //	case anthropic.BetaServerToolCaller:
 15614  //	case anthropic.BetaServerToolCaller20260120:
 15615  //	default:
 15616  //	  fmt.Errorf("no variant present")
 15617  //	}
 15618  func (u BetaWebSearchToolResultBlockCallerUnion) AsAny() anyBetaWebSearchToolResultBlockCaller {
 15619  	switch u.Type {
 15620  	case "direct":
 15621  		return u.AsDirect()
 15622  	case "code_execution_20250825":
 15623  		return u.AsCodeExecution20250825()
 15624  	case "code_execution_20260120":
 15625  		return u.AsCodeExecution20260120()
 15626  	}
 15627  	return nil
 15628  }
 15629  
 15630  func (u BetaWebSearchToolResultBlockCallerUnion) AsDirect() (v BetaDirectCaller) {
 15631  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15632  	return
 15633  }
 15634  
 15635  func (u BetaWebSearchToolResultBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller) {
 15636  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15637  	return
 15638  }
 15639  
 15640  func (u BetaWebSearchToolResultBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120) {
 15641  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15642  	return
 15643  }
 15644  
 15645  // Returns the unmodified JSON received from the API
 15646  func (u BetaWebSearchToolResultBlockCallerUnion) RawJSON() string { return u.JSON.raw }
 15647  
 15648  func (r *BetaWebSearchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error {
 15649  	return apijson.UnmarshalRoot(data, r)
 15650  }
 15651  
 15652  // BetaWebSearchToolResultBlockContentUnion contains all possible properties and
 15653  // values from [BetaWebSearchToolResultError], [[]BetaWebSearchResultBlock].
 15654  //
 15655  // Use the methods beginning with 'As' to cast the union to one of its variants.
 15656  //
 15657  // If the underlying value is not a json object, one of the following properties
 15658  // will be valid: OfBetaWebSearchResultBlockArray]
 15659  type BetaWebSearchToolResultBlockContentUnion struct {
 15660  	// This field will be present if the value is a [[]BetaWebSearchResultBlock]
 15661  	// instead of an object.
 15662  	OfBetaWebSearchResultBlockArray []BetaWebSearchResultBlock `json:",inline"`
 15663  	// This field is from variant [BetaWebSearchToolResultError].
 15664  	ErrorCode BetaWebSearchToolResultErrorCode `json:"error_code"`
 15665  	// This field is from variant [BetaWebSearchToolResultError].
 15666  	Type constant.WebSearchToolResultError `json:"type"`
 15667  	JSON struct {
 15668  		OfBetaWebSearchResultBlockArray respjson.Field
 15669  		ErrorCode                       respjson.Field
 15670  		Type                            respjson.Field
 15671  		raw                             string
 15672  	} `json:"-"`
 15673  }
 15674  
 15675  func (u BetaWebSearchToolResultBlockContentUnion) AsResponseWebSearchToolResultError() (v BetaWebSearchToolResultError) {
 15676  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15677  	return
 15678  }
 15679  
 15680  func (u BetaWebSearchToolResultBlockContentUnion) AsBetaWebSearchResultBlockArray() (v []BetaWebSearchResultBlock) {
 15681  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 15682  	return
 15683  }
 15684  
 15685  // Returns the unmodified JSON received from the API
 15686  func (u BetaWebSearchToolResultBlockContentUnion) RawJSON() string { return u.JSON.raw }
 15687  
 15688  func (r *BetaWebSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error {
 15689  	return apijson.UnmarshalRoot(data, r)
 15690  }
 15691  
 15692  // The properties Content, ToolUseID, Type are required.
 15693  type BetaWebSearchToolResultBlockParam struct {
 15694  	Content   BetaWebSearchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
 15695  	ToolUseID string                                        `json:"tool_use_id" api:"required"`
 15696  	// Create a cache control breakpoint at this content block.
 15697  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 15698  	// Tool invocation directly from the model.
 15699  	Caller BetaWebSearchToolResultBlockParamCallerUnion `json:"caller,omitzero"`
 15700  	// This field can be elided, and will marshal its zero value as
 15701  	// "web_search_tool_result".
 15702  	Type constant.WebSearchToolResult `json:"type" default:"web_search_tool_result"`
 15703  	paramObj
 15704  }
 15705  
 15706  func (r BetaWebSearchToolResultBlockParam) MarshalJSON() (data []byte, err error) {
 15707  	type shadow BetaWebSearchToolResultBlockParam
 15708  	return param.MarshalObject(r, (*shadow)(&r))
 15709  }
 15710  func (r *BetaWebSearchToolResultBlockParam) UnmarshalJSON(data []byte) error {
 15711  	return apijson.UnmarshalRoot(data, r)
 15712  }
 15713  
 15714  // Only one field can be non-zero.
 15715  //
 15716  // Use [param.IsOmitted] to confirm if a field is set.
 15717  type BetaWebSearchToolResultBlockParamCallerUnion struct {
 15718  	OfDirect                *BetaDirectCallerParam             `json:",omitzero,inline"`
 15719  	OfCodeExecution20250825 *BetaServerToolCallerParam         `json:",omitzero,inline"`
 15720  	OfCodeExecution20260120 *BetaServerToolCaller20260120Param `json:",omitzero,inline"`
 15721  	paramUnion
 15722  }
 15723  
 15724  func (u BetaWebSearchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error) {
 15725  	return param.MarshalUnion(u, u.OfDirect, u.OfCodeExecution20250825, u.OfCodeExecution20260120)
 15726  }
 15727  func (u *BetaWebSearchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error {
 15728  	return apijson.UnmarshalRoot(data, u)
 15729  }
 15730  
 15731  func (u *BetaWebSearchToolResultBlockParamCallerUnion) asAny() any {
 15732  	if !param.IsOmitted(u.OfDirect) {
 15733  		return u.OfDirect
 15734  	} else if !param.IsOmitted(u.OfCodeExecution20250825) {
 15735  		return u.OfCodeExecution20250825
 15736  	} else if !param.IsOmitted(u.OfCodeExecution20260120) {
 15737  		return u.OfCodeExecution20260120
 15738  	}
 15739  	return nil
 15740  }
 15741  
 15742  // Returns a pointer to the underlying variant's property, if present.
 15743  func (u BetaWebSearchToolResultBlockParamCallerUnion) GetType() *string {
 15744  	if vt := u.OfDirect; vt != nil {
 15745  		return (*string)(&vt.Type)
 15746  	} else if vt := u.OfCodeExecution20250825; vt != nil {
 15747  		return (*string)(&vt.Type)
 15748  	} else if vt := u.OfCodeExecution20260120; vt != nil {
 15749  		return (*string)(&vt.Type)
 15750  	}
 15751  	return nil
 15752  }
 15753  
 15754  // Returns a pointer to the underlying variant's property, if present.
 15755  func (u BetaWebSearchToolResultBlockParamCallerUnion) GetToolID() *string {
 15756  	if vt := u.OfCodeExecution20250825; vt != nil {
 15757  		return (*string)(&vt.ToolID)
 15758  	} else if vt := u.OfCodeExecution20260120; vt != nil {
 15759  		return (*string)(&vt.ToolID)
 15760  	}
 15761  	return nil
 15762  }
 15763  
 15764  func init() {
 15765  	apijson.RegisterUnion[BetaWebSearchToolResultBlockParamCallerUnion](
 15766  		"type",
 15767  		apijson.Discriminator[BetaDirectCallerParam]("direct"),
 15768  		apijson.Discriminator[BetaServerToolCallerParam]("code_execution_20250825"),
 15769  		apijson.Discriminator[BetaServerToolCaller20260120Param]("code_execution_20260120"),
 15770  	)
 15771  }
 15772  
 15773  func BetaNewWebSearchToolRequestError(errorCode BetaWebSearchToolResultErrorCode) BetaWebSearchToolResultBlockParamContentUnion {
 15774  	var variant BetaWebSearchToolRequestErrorParam
 15775  	variant.ErrorCode = errorCode
 15776  	return BetaWebSearchToolResultBlockParamContentUnion{OfError: &variant}
 15777  }
 15778  
 15779  // Only one field can be non-zero.
 15780  //
 15781  // Use [param.IsOmitted] to confirm if a field is set.
 15782  type BetaWebSearchToolResultBlockParamContentUnion struct {
 15783  	OfResultBlock []BetaWebSearchResultBlockParam     `json:",omitzero,inline"`
 15784  	OfError       *BetaWebSearchToolRequestErrorParam `json:",omitzero,inline"`
 15785  	paramUnion
 15786  }
 15787  
 15788  func (u BetaWebSearchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error) {
 15789  	return param.MarshalUnion(u, u.OfResultBlock, u.OfError)
 15790  }
 15791  func (u *BetaWebSearchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error {
 15792  	return apijson.UnmarshalRoot(data, u)
 15793  }
 15794  
 15795  func (u *BetaWebSearchToolResultBlockParamContentUnion) asAny() any {
 15796  	if !param.IsOmitted(u.OfResultBlock) {
 15797  		return &u.OfResultBlock
 15798  	} else if !param.IsOmitted(u.OfError) {
 15799  		return u.OfError
 15800  	}
 15801  	return nil
 15802  }
 15803  
 15804  type BetaWebSearchToolResultError struct {
 15805  	// Any of "invalid_tool_input", "unavailable", "max_uses_exceeded",
 15806  	// "too_many_requests", "query_too_long", "request_too_large".
 15807  	ErrorCode BetaWebSearchToolResultErrorCode  `json:"error_code" api:"required"`
 15808  	Type      constant.WebSearchToolResultError `json:"type" default:"web_search_tool_result_error"`
 15809  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 15810  	JSON struct {
 15811  		ErrorCode   respjson.Field
 15812  		Type        respjson.Field
 15813  		ExtraFields map[string]respjson.Field
 15814  		raw         string
 15815  	} `json:"-"`
 15816  }
 15817  
 15818  // Returns the unmodified JSON received from the API
 15819  func (r BetaWebSearchToolResultError) RawJSON() string { return r.JSON.raw }
 15820  func (r *BetaWebSearchToolResultError) UnmarshalJSON(data []byte) error {
 15821  	return apijson.UnmarshalRoot(data, r)
 15822  }
 15823  
 15824  type BetaWebSearchToolResultErrorCode string
 15825  
 15826  const (
 15827  	BetaWebSearchToolResultErrorCodeInvalidToolInput BetaWebSearchToolResultErrorCode = "invalid_tool_input"
 15828  	BetaWebSearchToolResultErrorCodeUnavailable      BetaWebSearchToolResultErrorCode = "unavailable"
 15829  	BetaWebSearchToolResultErrorCodeMaxUsesExceeded  BetaWebSearchToolResultErrorCode = "max_uses_exceeded"
 15830  	BetaWebSearchToolResultErrorCodeTooManyRequests  BetaWebSearchToolResultErrorCode = "too_many_requests"
 15831  	BetaWebSearchToolResultErrorCodeQueryTooLong     BetaWebSearchToolResultErrorCode = "query_too_long"
 15832  	BetaWebSearchToolResultErrorCodeRequestTooLarge  BetaWebSearchToolResultErrorCode = "request_too_large"
 15833  )
 15834  
 15835  type BetaMessageNewParams struct {
 15836  	// The maximum number of tokens to generate before stopping.
 15837  	//
 15838  	// Note that our models may stop _before_ reaching this maximum. This parameter
 15839  	// only specifies the absolute maximum number of tokens to generate.
 15840  	//
 15841  	// Set to `0` to populate the
 15842  	// [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache)
 15843  	// without generating a response.
 15844  	//
 15845  	// Different models have different maximum values for this parameter. See
 15846  	// [models](https://platform.claude.com/docs/en/about-claude/models/overview) for
 15847  	// details.
 15848  	MaxTokens int64 `json:"max_tokens" api:"required"`
 15849  	// Input messages.
 15850  	//
 15851  	// Our models are trained to operate on alternating `user` and `assistant`
 15852  	// conversational turns. When creating a new `Message`, you specify the prior
 15853  	// conversational turns with the `messages` parameter, and the model then generates
 15854  	// the next `Message` in the conversation. Consecutive `user` or `assistant` turns
 15855  	// in your request will be combined into a single turn.
 15856  	//
 15857  	// Each input message must be an object with a `role` and `content`. You can
 15858  	// specify a single `user`-role message, or you can include multiple `user` and
 15859  	// `assistant` messages.
 15860  	//
 15861  	// If the final message uses the `assistant` role, the response content will
 15862  	// continue immediately from the content in that message. This can be used to
 15863  	// constrain part of the model's response.
 15864  	//
 15865  	// Example with a single `user` message:
 15866  	//
 15867  	// ```json
 15868  	// [{ "role": "user", "content": "Hello, Claude" }]
 15869  	// ```
 15870  	//
 15871  	// Example with multiple conversational turns:
 15872  	//
 15873  	// ```json
 15874  	// [
 15875  	//
 15876  	//	{ "role": "user", "content": "Hello there." },
 15877  	//	{ "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
 15878  	//	{ "role": "user", "content": "Can you explain LLMs in plain English?" }
 15879  	//
 15880  	// ]
 15881  	// ```
 15882  	//
 15883  	// Example with a partially-filled response from Claude:
 15884  	//
 15885  	// ```json
 15886  	// [
 15887  	//
 15888  	//	{
 15889  	//	  "role": "user",
 15890  	//	  "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
 15891  	//	},
 15892  	//	{ "role": "assistant", "content": "The best answer is (" }
 15893  	//
 15894  	// ]
 15895  	// ```
 15896  	//
 15897  	// Each input message `content` may be either a single `string` or an array of
 15898  	// content blocks, where each block has a specific `type`. Using a `string` for
 15899  	// `content` is shorthand for an array of one content block of type `"text"`. The
 15900  	// following input messages are equivalent:
 15901  	//
 15902  	// ```json
 15903  	// { "role": "user", "content": "Hello, Claude" }
 15904  	// ```
 15905  	//
 15906  	// ```json
 15907  	// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
 15908  	// ```
 15909  	//
 15910  	// See
 15911  	// [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
 15912  	//
 15913  	// Note that if you want to include a
 15914  	// [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
 15915  	// you can use the top-level `system` parameter — there is no `"system"` role for
 15916  	// input messages in the Messages API.
 15917  	//
 15918  	// There is a limit of 100,000 messages in a single request.
 15919  	Messages []BetaMessageParam `json:"messages,omitzero" api:"required"`
 15920  	// The model that will complete your prompt.
 15921  	//
 15922  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
 15923  	// details and options.
 15924  	Model Model `json:"model,omitzero" api:"required"`
 15925  	// Specifies the geographic region for inference processing. If not specified, the
 15926  	// workspace's `default_inference_geo` is used.
 15927  	InferenceGeo param.Opt[string] `json:"inference_geo,omitzero"`
 15928  	// Amount of randomness injected into the response.
 15929  	//
 15930  	// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
 15931  	// for analytical / multiple choice, and closer to `1.0` for creative and
 15932  	// generative tasks.
 15933  	//
 15934  	// Note that even with `temperature` of `0.0`, the results will not be fully
 15935  	// deterministic.
 15936  	Temperature param.Opt[float64] `json:"temperature,omitzero"`
 15937  	// Only sample from the top K options for each subsequent token.
 15938  	//
 15939  	// Used to remove "long tail" low probability responses.
 15940  	// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
 15941  	//
 15942  	// Recommended for advanced use cases only.
 15943  	TopK param.Opt[int64] `json:"top_k,omitzero"`
 15944  	// Use nucleus sampling.
 15945  	//
 15946  	// In nucleus sampling, we compute the cumulative distribution over all the options
 15947  	// for each subsequent token in decreasing probability order and cut it off once it
 15948  	// reaches a particular probability specified by `top_p`.
 15949  	//
 15950  	// Recommended for advanced use cases only.
 15951  	TopP param.Opt[float64] `json:"top_p,omitzero"`
 15952  	// The user profile ID to attribute this request to. Use when acting on behalf of a
 15953  	// party other than your organization. Requires the `user-profiles` beta header.
 15954  	UserProfileID param.Opt[string] `header:"anthropic-user-profile-id,omitzero" json:"-"`
 15955  	WorkspaceID   param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
 15956  	// Container identifier for reuse across requests.
 15957  	Container BetaMessageNewParamsContainerUnion `json:"container,omitzero"`
 15958  	// The `fallback_credit_token` from a prior refusal's `stop_details`.
 15959  	//
 15960  	// When a preceding request was refused and returned a `fallback_credit_token`,
 15961  	// pass that code here on the retry to have the retry's cache-creation tokens for
 15962  	// the prefix that was warm on the refused model billed at the cache-read rate.
 15963  	// Must be redeemed by the same organization and workspace, with the same request
 15964  	// body (optionally extended by one appended `assistant` message whose content is
 15965  	// the partial text — with any trailing whitespace stripped from the final text
 15966  	// block — and paired server-tool blocks streamed before the refusal; the
 15967  	// appended-assistant form is not available for requests with `output_format` set
 15968  	// or forced `tool_choice`), on an eligible fallback model, on the same platform,
 15969  	// and within 5 minutes of the refusal; a mismatch is a 400. A token minted
 15970  	// mid-server-tool-loop whose partial content was continuable may only be redeemed
 15971  	// with the appended-assistant form — if an exact-body retry is rejected with a 400
 15972  	// saying the token must be redeemed by continuing the partial response, retry with
 15973  	// the appended-assistant form instead.
 15974  	//
 15975  	// When the appended-assistant form is used on a model that otherwise disallows
 15976  	// assistant-turn prefill, this token also authorizes that one prefill.
 15977  	FallbackCreditToken BetaMessageNewParamsFallbackCreditTokenUnion `json:"fallback_credit_token,omitzero"`
 15978  	// Opt-in server-side retry on one or more substitute models when the requested
 15979  	// model declines for policy reasons. Tried in order: if the first entry also
 15980  	// declines, the second is tried, and so on. The string "default" requests the
 15981  	// requested model's server-defined default fallback configuration.
 15982  	Fallbacks BetaFallbacksParamUnion `json:"fallbacks,omitzero"`
 15983  	// Inference speed mode. `fast` provides significantly faster output token
 15984  	// generation at premium pricing. Not all models support `fast`; invalid
 15985  	// combinations are rejected at create time.
 15986  	//
 15987  	// Any of "standard", "fast".
 15988  	Speed BetaMessageNewParamsSpeed `json:"speed,omitzero"`
 15989  	// Top-level cache control automatically applies a cache_control marker to the last
 15990  	// cacheable block in the request.
 15991  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 15992  	// Context management configuration.
 15993  	//
 15994  	// This allows you to control how Claude manages context across multiple requests,
 15995  	// such as whether to clear function results or not.
 15996  	ContextManagement BetaContextManagementConfigParam `json:"context_management,omitzero"`
 15997  	// Request-level diagnostics. Currently carries the previous response id for
 15998  	// prompt-cache divergence reporting.
 15999  	Diagnostics BetaDiagnosticsParam `json:"diagnostics,omitzero"`
 16000  	// MCP servers to be utilized in this request
 16001  	MCPServers []BetaRequestMCPServerURLDefinitionParam `json:"mcp_servers,omitzero"`
 16002  	// An object describing metadata about the request.
 16003  	Metadata BetaMetadataParam `json:"metadata,omitzero"`
 16004  	// Configuration options for the model's output, such as the output format.
 16005  	OutputConfig BetaOutputConfigParam `json:"output_config,omitzero"`
 16006  	// Deprecated: Use `output_config.format` instead. See
 16007  	// [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
 16008  	//
 16009  	// A schema to specify Claude's output format in responses. This parameter will be
 16010  	// removed in a future release.
 16011  	OutputFormat BetaJSONOutputFormatParam `json:"output_format,omitzero"`
 16012  	// Determines whether to use priority capacity (if available) or standard capacity
 16013  	// for this request.
 16014  	//
 16015  	// Anthropic offers different levels of service for your API requests. See
 16016  	// [service-tiers](https://platform.claude.com/docs/en/api/service-tiers) for
 16017  	// details.
 16018  	//
 16019  	// Any of "auto", "standard_only".
 16020  	ServiceTier BetaMessageNewParamsServiceTier `json:"service_tier,omitzero"`
 16021  	// Custom text sequences that will cause the model to stop generating.
 16022  	//
 16023  	// Our models will normally stop when they have naturally completed their turn,
 16024  	// which will result in a response `stop_reason` of `"end_turn"`.
 16025  	//
 16026  	// If you want the model to stop generating when it encounters custom strings of
 16027  	// text, you can use the `stop_sequences` parameter. If the model encounters one of
 16028  	// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
 16029  	// and the response `stop_sequence` value will contain the matched stop sequence.
 16030  	StopSequences []string `json:"stop_sequences,omitzero"`
 16031  	// System prompt.
 16032  	//
 16033  	// A system prompt is a way of providing context and instructions to Claude, such
 16034  	// as specifying a particular goal or role. See our
 16035  	// [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
 16036  	System []BetaTextBlockParam `json:"system,omitzero"`
 16037  	// Configuration for enabling Claude's extended thinking.
 16038  	//
 16039  	// When enabled, responses include `thinking` content blocks showing Claude's
 16040  	// thinking process before the final answer. Requires a minimum budget of 1,024
 16041  	// tokens and counts towards your `max_tokens` limit.
 16042  	//
 16043  	// See
 16044  	// [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
 16045  	// for details.
 16046  	Thinking BetaThinkingConfigParamUnion `json:"thinking,omitzero"`
 16047  	// How the model should use the provided tools. The model can use a specific tool,
 16048  	// any available tool, decide by itself, or not use tools at all.
 16049  	ToolChoice BetaToolChoiceUnionParam `json:"tool_choice,omitzero"`
 16050  	// Definitions of tools that the model may use.
 16051  	//
 16052  	// If you include `tools` in your API request, the model may return `tool_use`
 16053  	// content blocks that represent the model's use of those tools. You can then run
 16054  	// those tools using the tool input generated by the model and then optionally
 16055  	// return results back to the model using `tool_result` content blocks.
 16056  	//
 16057  	// There are two types of tools: **client tools** and **server tools**. The
 16058  	// behavior described below applies to client tools. For
 16059  	// [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
 16060  	// see their individual documentation as each has its own behavior (e.g., the
 16061  	// [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
 16062  	//
 16063  	// Each tool definition includes:
 16064  	//
 16065  	//   - `name`: Name of the tool.
 16066  	//   - `description`: Optional, but strongly-recommended description of the tool.
 16067  	//   - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
 16068  	//     tool `input` shape that the model will produce in `tool_use` output content
 16069  	//     blocks.
 16070  	//
 16071  	// For example, if you defined `tools` as:
 16072  	//
 16073  	// ```json
 16074  	// [
 16075  	//
 16076  	//	{
 16077  	//	  "name": "get_stock_price",
 16078  	//	  "description": "Get the current stock price for a given ticker symbol.",
 16079  	//	  "input_schema": {
 16080  	//	    "type": "object",
 16081  	//	    "properties": {
 16082  	//	      "ticker": {
 16083  	//	        "type": "string",
 16084  	//	        "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
 16085  	//	      }
 16086  	//	    },
 16087  	//	    "required": ["ticker"]
 16088  	//	  }
 16089  	//	}
 16090  	//
 16091  	// ]
 16092  	// ```
 16093  	//
 16094  	// And then asked the model "What's the S&P 500 at today?", the model might produce
 16095  	// `tool_use` content blocks in the response like this:
 16096  	//
 16097  	// ```json
 16098  	// [
 16099  	//
 16100  	//	{
 16101  	//	  "type": "tool_use",
 16102  	//	  "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
 16103  	//	  "name": "get_stock_price",
 16104  	//	  "input": { "ticker": "^GSPC" }
 16105  	//	}
 16106  	//
 16107  	// ]
 16108  	// ```
 16109  	//
 16110  	// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
 16111  	// input, and return the following back to the model in a subsequent `user`
 16112  	// message:
 16113  	//
 16114  	// ```json
 16115  	// [
 16116  	//
 16117  	//	{
 16118  	//	  "type": "tool_result",
 16119  	//	  "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
 16120  	//	  "content": "259.75 USD"
 16121  	//	}
 16122  	//
 16123  	// ]
 16124  	// ```
 16125  	//
 16126  	// Tools can be used for workflows that include running client-side tools and
 16127  	// functions, or more generally whenever you want the model to produce a particular
 16128  	// JSON structure of output.
 16129  	//
 16130  	// See our
 16131  	// [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
 16132  	// for more details.
 16133  	Tools []BetaToolUnionParam `json:"tools,omitzero"`
 16134  	// Optional header to specify the beta version(s) you want to use.
 16135  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
 16136  	paramObj
 16137  }
 16138  
 16139  func (r BetaMessageNewParams) MarshalJSON() (data []byte, err error) {
 16140  	type shadow BetaMessageNewParams
 16141  	return param.MarshalObject(r, (*shadow)(&r))
 16142  }
 16143  func (r *BetaMessageNewParams) UnmarshalJSON(data []byte) error {
 16144  	return apijson.UnmarshalRoot(data, r)
 16145  }
 16146  
 16147  // Only one field can be non-zero.
 16148  //
 16149  // Use [param.IsOmitted] to confirm if a field is set.
 16150  type BetaMessageNewParamsContainerUnion struct {
 16151  	OfContainers *BetaContainerParams `json:",omitzero,inline"`
 16152  	OfString     param.Opt[string]    `json:",omitzero,inline"`
 16153  	paramUnion
 16154  }
 16155  
 16156  func (u BetaMessageNewParamsContainerUnion) MarshalJSON() ([]byte, error) {
 16157  	return param.MarshalUnion(u, u.OfContainers, u.OfString)
 16158  }
 16159  func (u *BetaMessageNewParamsContainerUnion) UnmarshalJSON(data []byte) error {
 16160  	return apijson.UnmarshalRoot(data, u)
 16161  }
 16162  
 16163  func (u *BetaMessageNewParamsContainerUnion) asAny() any {
 16164  	if !param.IsOmitted(u.OfContainers) {
 16165  		return u.OfContainers
 16166  	} else if !param.IsOmitted(u.OfString) {
 16167  		return &u.OfString.Value
 16168  	}
 16169  	return nil
 16170  }
 16171  
 16172  // Only one field can be non-zero.
 16173  //
 16174  // Use [param.IsOmitted] to confirm if a field is set.
 16175  type BetaMessageNewParamsFallbackCreditTokenUnion struct {
 16176  	OfString              param.Opt[string]             `json:",omitzero,inline"`
 16177  	OfFallbackCreditToken *BetaFallbackCreditTokenParam `json:",omitzero,inline"`
 16178  	paramUnion
 16179  }
 16180  
 16181  func (u BetaMessageNewParamsFallbackCreditTokenUnion) MarshalJSON() ([]byte, error) {
 16182  	return param.MarshalUnion(u, u.OfString, u.OfFallbackCreditToken)
 16183  }
 16184  func (u *BetaMessageNewParamsFallbackCreditTokenUnion) UnmarshalJSON(data []byte) error {
 16185  	return apijson.UnmarshalRoot(data, u)
 16186  }
 16187  
 16188  func (u *BetaMessageNewParamsFallbackCreditTokenUnion) asAny() any {
 16189  	if !param.IsOmitted(u.OfString) {
 16190  		return &u.OfString.Value
 16191  	} else if !param.IsOmitted(u.OfFallbackCreditToken) {
 16192  		return u.OfFallbackCreditToken
 16193  	}
 16194  	return nil
 16195  }
 16196  
 16197  // Determines whether to use priority capacity (if available) or standard capacity
 16198  // for this request.
 16199  //
 16200  // Anthropic offers different levels of service for your API requests. See
 16201  // [service-tiers](https://platform.claude.com/docs/en/api/service-tiers) for
 16202  // details.
 16203  type BetaMessageNewParamsServiceTier string
 16204  
 16205  const (
 16206  	BetaMessageNewParamsServiceTierAuto         BetaMessageNewParamsServiceTier = "auto"
 16207  	BetaMessageNewParamsServiceTierStandardOnly BetaMessageNewParamsServiceTier = "standard_only"
 16208  )
 16209  
 16210  // Inference speed mode. `fast` provides significantly faster output token
 16211  // generation at premium pricing. Not all models support `fast`; invalid
 16212  // combinations are rejected at create time.
 16213  type BetaMessageNewParamsSpeed string
 16214  
 16215  const (
 16216  	BetaMessageNewParamsSpeedStandard BetaMessageNewParamsSpeed = "standard"
 16217  	BetaMessageNewParamsSpeedFast     BetaMessageNewParamsSpeed = "fast"
 16218  )
 16219  
 16220  type BetaMessageCountTokensParams struct {
 16221  	// Input messages.
 16222  	//
 16223  	// Our models are trained to operate on alternating `user` and `assistant`
 16224  	// conversational turns. When creating a new `Message`, you specify the prior
 16225  	// conversational turns with the `messages` parameter, and the model then generates
 16226  	// the next `Message` in the conversation. Consecutive `user` or `assistant` turns
 16227  	// in your request will be combined into a single turn.
 16228  	//
 16229  	// Each input message must be an object with a `role` and `content`. You can
 16230  	// specify a single `user`-role message, or you can include multiple `user` and
 16231  	// `assistant` messages.
 16232  	//
 16233  	// If the final message uses the `assistant` role, the response content will
 16234  	// continue immediately from the content in that message. This can be used to
 16235  	// constrain part of the model's response.
 16236  	//
 16237  	// Example with a single `user` message:
 16238  	//
 16239  	// ```json
 16240  	// [{ "role": "user", "content": "Hello, Claude" }]
 16241  	// ```
 16242  	//
 16243  	// Example with multiple conversational turns:
 16244  	//
 16245  	// ```json
 16246  	// [
 16247  	//
 16248  	//	{ "role": "user", "content": "Hello there." },
 16249  	//	{ "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
 16250  	//	{ "role": "user", "content": "Can you explain LLMs in plain English?" }
 16251  	//
 16252  	// ]
 16253  	// ```
 16254  	//
 16255  	// Example with a partially-filled response from Claude:
 16256  	//
 16257  	// ```json
 16258  	// [
 16259  	//
 16260  	//	{
 16261  	//	  "role": "user",
 16262  	//	  "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
 16263  	//	},
 16264  	//	{ "role": "assistant", "content": "The best answer is (" }
 16265  	//
 16266  	// ]
 16267  	// ```
 16268  	//
 16269  	// Each input message `content` may be either a single `string` or an array of
 16270  	// content blocks, where each block has a specific `type`. Using a `string` for
 16271  	// `content` is shorthand for an array of one content block of type `"text"`. The
 16272  	// following input messages are equivalent:
 16273  	//
 16274  	// ```json
 16275  	// { "role": "user", "content": "Hello, Claude" }
 16276  	// ```
 16277  	//
 16278  	// ```json
 16279  	// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
 16280  	// ```
 16281  	//
 16282  	// See
 16283  	// [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
 16284  	//
 16285  	// Note that if you want to include a
 16286  	// [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
 16287  	// you can use the top-level `system` parameter — there is no `"system"` role for
 16288  	// input messages in the Messages API.
 16289  	//
 16290  	// There is a limit of 100,000 messages in a single request.
 16291  	Messages []BetaMessageParam `json:"messages,omitzero" api:"required"`
 16292  	// The model that will complete your prompt.
 16293  	//
 16294  	// See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
 16295  	// details and options.
 16296  	Model Model `json:"model,omitzero" api:"required"`
 16297  	// The user profile ID to attribute this request to. Use when acting on behalf of a
 16298  	// party other than your organization. Requires the `user-profiles` beta header.
 16299  	UserProfileID param.Opt[string] `header:"anthropic-user-profile-id,omitzero" json:"-"`
 16300  	WorkspaceID   param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
 16301  	// Inference speed mode. `fast` provides significantly faster output token
 16302  	// generation at premium pricing. Not all models support `fast`; invalid
 16303  	// combinations are rejected at create time.
 16304  	//
 16305  	// Any of "standard", "fast".
 16306  	Speed BetaMessageCountTokensParamsSpeed `json:"speed,omitzero"`
 16307  	// Top-level cache control automatically applies a cache_control marker to the last
 16308  	// cacheable block in the request.
 16309  	CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
 16310  	// Context management configuration.
 16311  	//
 16312  	// This allows you to control how Claude manages context across multiple requests,
 16313  	// such as whether to clear function results or not.
 16314  	ContextManagement BetaContextManagementConfigParam `json:"context_management,omitzero"`
 16315  	// MCP servers to be utilized in this request
 16316  	MCPServers []BetaRequestMCPServerURLDefinitionParam `json:"mcp_servers,omitzero"`
 16317  	// Configuration options for the model's output, such as the output format.
 16318  	OutputConfig BetaOutputConfigParam `json:"output_config,omitzero"`
 16319  	// Deprecated: Use `output_config.format` instead. See
 16320  	// [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
 16321  	//
 16322  	// A schema to specify Claude's output format in responses. This parameter will be
 16323  	// removed in a future release.
 16324  	OutputFormat BetaJSONOutputFormatParam `json:"output_format,omitzero"`
 16325  	// System prompt.
 16326  	//
 16327  	// A system prompt is a way of providing context and instructions to Claude, such
 16328  	// as specifying a particular goal or role. See our
 16329  	// [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
 16330  	System BetaMessageCountTokensParamsSystemUnion `json:"system,omitzero"`
 16331  	// Configuration for enabling Claude's extended thinking.
 16332  	//
 16333  	// When enabled, responses include `thinking` content blocks showing Claude's
 16334  	// thinking process before the final answer. Requires a minimum budget of 1,024
 16335  	// tokens and counts towards your `max_tokens` limit.
 16336  	//
 16337  	// See
 16338  	// [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
 16339  	// for details.
 16340  	Thinking BetaThinkingConfigParamUnion `json:"thinking,omitzero"`
 16341  	// How the model should use the provided tools. The model can use a specific tool,
 16342  	// any available tool, decide by itself, or not use tools at all.
 16343  	ToolChoice BetaToolChoiceUnionParam `json:"tool_choice,omitzero"`
 16344  	// Definitions of tools that the model may use.
 16345  	//
 16346  	// If you include `tools` in your API request, the model may return `tool_use`
 16347  	// content blocks that represent the model's use of those tools. You can then run
 16348  	// those tools using the tool input generated by the model and then optionally
 16349  	// return results back to the model using `tool_result` content blocks.
 16350  	//
 16351  	// There are two types of tools: **client tools** and **server tools**. The
 16352  	// behavior described below applies to client tools. For
 16353  	// [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
 16354  	// see their individual documentation as each has its own behavior (e.g., the
 16355  	// [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
 16356  	//
 16357  	// Each tool definition includes:
 16358  	//
 16359  	//   - `name`: Name of the tool.
 16360  	//   - `description`: Optional, but strongly-recommended description of the tool.
 16361  	//   - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
 16362  	//     tool `input` shape that the model will produce in `tool_use` output content
 16363  	//     blocks.
 16364  	//
 16365  	// For example, if you defined `tools` as:
 16366  	//
 16367  	// ```json
 16368  	// [
 16369  	//
 16370  	//	{
 16371  	//	  "name": "get_stock_price",
 16372  	//	  "description": "Get the current stock price for a given ticker symbol.",
 16373  	//	  "input_schema": {
 16374  	//	    "type": "object",
 16375  	//	    "properties": {
 16376  	//	      "ticker": {
 16377  	//	        "type": "string",
 16378  	//	        "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
 16379  	//	      }
 16380  	//	    },
 16381  	//	    "required": ["ticker"]
 16382  	//	  }
 16383  	//	}
 16384  	//
 16385  	// ]
 16386  	// ```
 16387  	//
 16388  	// And then asked the model "What's the S&P 500 at today?", the model might produce
 16389  	// `tool_use` content blocks in the response like this:
 16390  	//
 16391  	// ```json
 16392  	// [
 16393  	//
 16394  	//	{
 16395  	//	  "type": "tool_use",
 16396  	//	  "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
 16397  	//	  "name": "get_stock_price",
 16398  	//	  "input": { "ticker": "^GSPC" }
 16399  	//	}
 16400  	//
 16401  	// ]
 16402  	// ```
 16403  	//
 16404  	// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
 16405  	// input, and return the following back to the model in a subsequent `user`
 16406  	// message:
 16407  	//
 16408  	// ```json
 16409  	// [
 16410  	//
 16411  	//	{
 16412  	//	  "type": "tool_result",
 16413  	//	  "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
 16414  	//	  "content": "259.75 USD"
 16415  	//	}
 16416  	//
 16417  	// ]
 16418  	// ```
 16419  	//
 16420  	// Tools can be used for workflows that include running client-side tools and
 16421  	// functions, or more generally whenever you want the model to produce a particular
 16422  	// JSON structure of output.
 16423  	//
 16424  	// See our
 16425  	// [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
 16426  	// for more details.
 16427  	Tools []BetaMessageCountTokensParamsToolUnion `json:"tools,omitzero"`
 16428  	// Optional header to specify the beta version(s) you want to use.
 16429  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
 16430  	paramObj
 16431  }
 16432  
 16433  func (r BetaMessageCountTokensParams) MarshalJSON() (data []byte, err error) {
 16434  	type shadow BetaMessageCountTokensParams
 16435  	return param.MarshalObject(r, (*shadow)(&r))
 16436  }
 16437  func (r *BetaMessageCountTokensParams) UnmarshalJSON(data []byte) error {
 16438  	return apijson.UnmarshalRoot(data, r)
 16439  }
 16440  
 16441  // Inference speed mode. `fast` provides significantly faster output token
 16442  // generation at premium pricing. Not all models support `fast`; invalid
 16443  // combinations are rejected at create time.
 16444  type BetaMessageCountTokensParamsSpeed string
 16445  
 16446  const (
 16447  	BetaMessageCountTokensParamsSpeedStandard BetaMessageCountTokensParamsSpeed = "standard"
 16448  	BetaMessageCountTokensParamsSpeedFast     BetaMessageCountTokensParamsSpeed = "fast"
 16449  )
 16450  
 16451  // Only one field can be non-zero.
 16452  //
 16453  // Use [param.IsOmitted] to confirm if a field is set.
 16454  type BetaMessageCountTokensParamsSystemUnion struct {
 16455  	OfString             param.Opt[string]    `json:",omitzero,inline"`
 16456  	OfBetaTextBlockArray []BetaTextBlockParam `json:",omitzero,inline"`
 16457  	paramUnion
 16458  }
 16459  
 16460  func (u BetaMessageCountTokensParamsSystemUnion) MarshalJSON() ([]byte, error) {
 16461  	return param.MarshalUnion(u, u.OfString, u.OfBetaTextBlockArray)
 16462  }
 16463  func (u *BetaMessageCountTokensParamsSystemUnion) UnmarshalJSON(data []byte) error {
 16464  	return apijson.UnmarshalRoot(data, u)
 16465  }
 16466  
 16467  func (u *BetaMessageCountTokensParamsSystemUnion) asAny() any {
 16468  	if !param.IsOmitted(u.OfString) {
 16469  		return &u.OfString.Value
 16470  	} else if !param.IsOmitted(u.OfBetaTextBlockArray) {
 16471  		return &u.OfBetaTextBlockArray
 16472  	}
 16473  	return nil
 16474  }
 16475  
 16476  // Only one field can be non-zero.
 16477  //
 16478  // Use [param.IsOmitted] to confirm if a field is set.
 16479  type BetaMessageCountTokensParamsToolUnion struct {
 16480  	OfTool                        *BetaToolParam                        `json:",omitzero,inline"`
 16481  	OfBashTool20241022            *BetaToolBash20241022Param            `json:",omitzero,inline"`
 16482  	OfBashTool20250124            *BetaToolBash20250124Param            `json:",omitzero,inline"`
 16483  	OfCodeExecutionTool20250522   *BetaCodeExecutionTool20250522Param   `json:",omitzero,inline"`
 16484  	OfCodeExecutionTool20250825   *BetaCodeExecutionTool20250825Param   `json:",omitzero,inline"`
 16485  	OfCodeExecutionTool20260120   *BetaCodeExecutionTool20260120Param   `json:",omitzero,inline"`
 16486  	OfCodeExecutionTool20260521   *BetaCodeExecutionTool20260521Param   `json:",omitzero,inline"`
 16487  	OfBrowserToolset20260801      *BetaBrowserToolset20260801Param      `json:",omitzero,inline"`
 16488  	OfComputerUseTool20241022     *BetaToolComputerUse20241022Param     `json:",omitzero,inline"`
 16489  	OfMemoryTool20250818          *BetaMemoryTool20250818Param          `json:",omitzero,inline"`
 16490  	OfComputerUseTool20250124     *BetaToolComputerUse20250124Param     `json:",omitzero,inline"`
 16491  	OfTextEditor20241022          *BetaToolTextEditor20241022Param      `json:",omitzero,inline"`
 16492  	OfComputerUseTool20251124     *BetaToolComputerUse20251124Param     `json:",omitzero,inline"`
 16493  	OfComputerToolset20260801     *BetaComputerToolset20260801Param     `json:",omitzero,inline"`
 16494  	OfTextEditor20250124          *BetaToolTextEditor20250124Param      `json:",omitzero,inline"`
 16495  	OfTextEditor20250429          *BetaToolTextEditor20250429Param      `json:",omitzero,inline"`
 16496  	OfTextEditor20250728          *BetaToolTextEditor20250728Param      `json:",omitzero,inline"`
 16497  	OfWebSearchTool20250305       *BetaWebSearchTool20250305Param       `json:",omitzero,inline"`
 16498  	OfWebFetchTool20250910        *BetaWebFetchTool20250910Param        `json:",omitzero,inline"`
 16499  	OfWebSearchTool20260209       *BetaWebSearchTool20260209Param       `json:",omitzero,inline"`
 16500  	OfWebFetchTool20260209        *BetaWebFetchTool20260209Param        `json:",omitzero,inline"`
 16501  	OfWebFetchTool20260309        *BetaWebFetchTool20260309Param        `json:",omitzero,inline"`
 16502  	OfWebSearchTool20260318       *BetaWebSearchTool20260318Param       `json:",omitzero,inline"`
 16503  	OfWebFetchTool20260318        *BetaWebFetchTool20260318Param        `json:",omitzero,inline"`
 16504  	OfAdvisorTool20260301         *BetaAdvisorTool20260301Param         `json:",omitzero,inline"`
 16505  	OfToolSearchToolBm25_20251119 *BetaToolSearchToolBm25_20251119Param `json:",omitzero,inline"`
 16506  	OfToolSearchToolRegex20251119 *BetaToolSearchToolRegex20251119Param `json:",omitzero,inline"`
 16507  	OfMCPToolset                  *BetaMCPToolsetParam                  `json:",omitzero,inline"`
 16508  	paramUnion
 16509  }
 16510  
 16511  func (u BetaMessageCountTokensParamsToolUnion) MarshalJSON() ([]byte, error) {
 16512  	return param.MarshalUnion(u, u.OfTool,
 16513  		u.OfBashTool20241022,
 16514  		u.OfBashTool20250124,
 16515  		u.OfCodeExecutionTool20250522,
 16516  		u.OfCodeExecutionTool20250825,
 16517  		u.OfCodeExecutionTool20260120,
 16518  		u.OfCodeExecutionTool20260521,
 16519  		u.OfBrowserToolset20260801,
 16520  		u.OfComputerUseTool20241022,
 16521  		u.OfMemoryTool20250818,
 16522  		u.OfComputerUseTool20250124,
 16523  		u.OfTextEditor20241022,
 16524  		u.OfComputerUseTool20251124,
 16525  		u.OfComputerToolset20260801,
 16526  		u.OfTextEditor20250124,
 16527  		u.OfTextEditor20250429,
 16528  		u.OfTextEditor20250728,
 16529  		u.OfWebSearchTool20250305,
 16530  		u.OfWebFetchTool20250910,
 16531  		u.OfWebSearchTool20260209,
 16532  		u.OfWebFetchTool20260209,
 16533  		u.OfWebFetchTool20260309,
 16534  		u.OfWebSearchTool20260318,
 16535  		u.OfWebFetchTool20260318,
 16536  		u.OfAdvisorTool20260301,
 16537  		u.OfToolSearchToolBm25_20251119,
 16538  		u.OfToolSearchToolRegex20251119,
 16539  		u.OfMCPToolset)
 16540  }
 16541  func (u *BetaMessageCountTokensParamsToolUnion) UnmarshalJSON(data []byte) error {
 16542  	return apijson.UnmarshalRoot(data, u)
 16543  }
 16544  
 16545  func (u *BetaMessageCountTokensParamsToolUnion) asAny() any {
 16546  	if !param.IsOmitted(u.OfTool) {
 16547  		return u.OfTool
 16548  	} else if !param.IsOmitted(u.OfBashTool20241022) {
 16549  		return u.OfBashTool20241022
 16550  	} else if !param.IsOmitted(u.OfBashTool20250124) {
 16551  		return u.OfBashTool20250124
 16552  	} else if !param.IsOmitted(u.OfCodeExecutionTool20250522) {
 16553  		return u.OfCodeExecutionTool20250522
 16554  	} else if !param.IsOmitted(u.OfCodeExecutionTool20250825) {
 16555  		return u.OfCodeExecutionTool20250825
 16556  	} else if !param.IsOmitted(u.OfCodeExecutionTool20260120) {
 16557  		return u.OfCodeExecutionTool20260120
 16558  	} else if !param.IsOmitted(u.OfCodeExecutionTool20260521) {
 16559  		return u.OfCodeExecutionTool20260521
 16560  	} else if !param.IsOmitted(u.OfBrowserToolset20260801) {
 16561  		return u.OfBrowserToolset20260801
 16562  	} else if !param.IsOmitted(u.OfComputerUseTool20241022) {
 16563  		return u.OfComputerUseTool20241022
 16564  	} else if !param.IsOmitted(u.OfMemoryTool20250818) {
 16565  		return u.OfMemoryTool20250818
 16566  	} else if !param.IsOmitted(u.OfComputerUseTool20250124) {
 16567  		return u.OfComputerUseTool20250124
 16568  	} else if !param.IsOmitted(u.OfTextEditor20241022) {
 16569  		return u.OfTextEditor20241022
 16570  	} else if !param.IsOmitted(u.OfComputerUseTool20251124) {
 16571  		return u.OfComputerUseTool20251124
 16572  	} else if !param.IsOmitted(u.OfComputerToolset20260801) {
 16573  		return u.OfComputerToolset20260801
 16574  	} else if !param.IsOmitted(u.OfTextEditor20250124) {
 16575  		return u.OfTextEditor20250124
 16576  	} else if !param.IsOmitted(u.OfTextEditor20250429) {
 16577  		return u.OfTextEditor20250429
 16578  	} else if !param.IsOmitted(u.OfTextEditor20250728) {
 16579  		return u.OfTextEditor20250728
 16580  	} else if !param.IsOmitted(u.OfWebSearchTool20250305) {
 16581  		return u.OfWebSearchTool20250305
 16582  	} else if !param.IsOmitted(u.OfWebFetchTool20250910) {
 16583  		return u.OfWebFetchTool20250910
 16584  	} else if !param.IsOmitted(u.OfWebSearchTool20260209) {
 16585  		return u.OfWebSearchTool20260209
 16586  	} else if !param.IsOmitted(u.OfWebFetchTool20260209) {
 16587  		return u.OfWebFetchTool20260209
 16588  	} else if !param.IsOmitted(u.OfWebFetchTool20260309) {
 16589  		return u.OfWebFetchTool20260309
 16590  	} else if !param.IsOmitted(u.OfWebSearchTool20260318) {
 16591  		return u.OfWebSearchTool20260318
 16592  	} else if !param.IsOmitted(u.OfWebFetchTool20260318) {
 16593  		return u.OfWebFetchTool20260318
 16594  	} else if !param.IsOmitted(u.OfAdvisorTool20260301) {
 16595  		return u.OfAdvisorTool20260301
 16596  	} else if !param.IsOmitted(u.OfToolSearchToolBm25_20251119) {
 16597  		return u.OfToolSearchToolBm25_20251119
 16598  	} else if !param.IsOmitted(u.OfToolSearchToolRegex20251119) {
 16599  		return u.OfToolSearchToolRegex20251119
 16600  	} else if !param.IsOmitted(u.OfMCPToolset) {
 16601  		return u.OfMCPToolset
 16602  	}
 16603  	return nil
 16604  }
 16605  
 16606  // Returns a pointer to the underlying variant's property, if present.
 16607  func (u BetaMessageCountTokensParamsToolUnion) GetInputSchema() *BetaToolInputSchemaParam {
 16608  	if vt := u.OfTool; vt != nil {
 16609  		return &vt.InputSchema
 16610  	}
 16611  	return nil
 16612  }
 16613  
 16614  // Returns a pointer to the underlying variant's property, if present.
 16615  func (u BetaMessageCountTokensParamsToolUnion) GetDescription() *string {
 16616  	if vt := u.OfTool; vt != nil && vt.Description.Valid() {
 16617  		return &vt.Description.Value
 16618  	}
 16619  	return nil
 16620  }
 16621  
 16622  // Returns a pointer to the underlying variant's property, if present.
 16623  func (u BetaMessageCountTokensParamsToolUnion) GetEagerInputStreaming() *bool {
 16624  	if vt := u.OfTool; vt != nil && vt.EagerInputStreaming.Valid() {
 16625  		return &vt.EagerInputStreaming.Value
 16626  	}
 16627  	return nil
 16628  }
 16629  
 16630  // Returns a pointer to the underlying variant's property, if present.
 16631  func (u BetaMessageCountTokensParamsToolUnion) GetEnableZoom() *bool {
 16632  	if vt := u.OfComputerUseTool20251124; vt != nil && vt.EnableZoom.Valid() {
 16633  		return &vt.EnableZoom.Value
 16634  	}
 16635  	return nil
 16636  }
 16637  
 16638  // Returns a pointer to the underlying variant's property, if present.
 16639  func (u BetaMessageCountTokensParamsToolUnion) GetMaxCharacters() *int64 {
 16640  	if vt := u.OfTextEditor20250728; vt != nil && vt.MaxCharacters.Valid() {
 16641  		return &vt.MaxCharacters.Value
 16642  	}
 16643  	return nil
 16644  }
 16645  
 16646  // Returns a pointer to the underlying variant's property, if present.
 16647  func (u BetaMessageCountTokensParamsToolUnion) GetModel() *Model {
 16648  	if vt := u.OfAdvisorTool20260301; vt != nil {
 16649  		return &vt.Model
 16650  	}
 16651  	return nil
 16652  }
 16653  
 16654  // Returns a pointer to the underlying variant's property, if present.
 16655  func (u BetaMessageCountTokensParamsToolUnion) GetCaching() *BetaCacheControlEphemeralParam {
 16656  	if vt := u.OfAdvisorTool20260301; vt != nil {
 16657  		return &vt.Caching
 16658  	}
 16659  	return nil
 16660  }
 16661  
 16662  // Returns a pointer to the underlying variant's property, if present.
 16663  func (u BetaMessageCountTokensParamsToolUnion) GetMaxTokens() *int64 {
 16664  	if vt := u.OfAdvisorTool20260301; vt != nil && vt.MaxTokens.Valid() {
 16665  		return &vt.MaxTokens.Value
 16666  	}
 16667  	return nil
 16668  }
 16669  
 16670  // Returns a pointer to the underlying variant's property, if present.
 16671  func (u BetaMessageCountTokensParamsToolUnion) GetMCPServerName() *string {
 16672  	if vt := u.OfMCPToolset; vt != nil {
 16673  		return &vt.MCPServerName
 16674  	}
 16675  	return nil
 16676  }
 16677  
 16678  // Returns a pointer to the underlying variant's property, if present.
 16679  func (u BetaMessageCountTokensParamsToolUnion) GetDefaultConfig() *BetaMCPToolDefaultConfigParam {
 16680  	if vt := u.OfMCPToolset; vt != nil {
 16681  		return &vt.DefaultConfig
 16682  	}
 16683  	return nil
 16684  }
 16685  
 16686  // Returns a pointer to the underlying variant's property, if present.
 16687  func (u BetaMessageCountTokensParamsToolUnion) GetName() *string {
 16688  	if vt := u.OfTool; vt != nil {
 16689  		return (*string)(&vt.Name)
 16690  	} else if vt := u.OfBashTool20241022; vt != nil {
 16691  		return (*string)(&vt.Name)
 16692  	} else if vt := u.OfBashTool20250124; vt != nil {
 16693  		return (*string)(&vt.Name)
 16694  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil {
 16695  		return (*string)(&vt.Name)
 16696  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil {
 16697  		return (*string)(&vt.Name)
 16698  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil {
 16699  		return (*string)(&vt.Name)
 16700  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil {
 16701  		return (*string)(&vt.Name)
 16702  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 16703  		return (*string)(&vt.Name)
 16704  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 16705  		return (*string)(&vt.Name)
 16706  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 16707  		return (*string)(&vt.Name)
 16708  	} else if vt := u.OfTextEditor20241022; vt != nil {
 16709  		return (*string)(&vt.Name)
 16710  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 16711  		return (*string)(&vt.Name)
 16712  	} else if vt := u.OfTextEditor20250124; vt != nil {
 16713  		return (*string)(&vt.Name)
 16714  	} else if vt := u.OfTextEditor20250429; vt != nil {
 16715  		return (*string)(&vt.Name)
 16716  	} else if vt := u.OfTextEditor20250728; vt != nil {
 16717  		return (*string)(&vt.Name)
 16718  	} else if vt := u.OfWebSearchTool20250305; vt != nil {
 16719  		return (*string)(&vt.Name)
 16720  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 16721  		return (*string)(&vt.Name)
 16722  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 16723  		return (*string)(&vt.Name)
 16724  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 16725  		return (*string)(&vt.Name)
 16726  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 16727  		return (*string)(&vt.Name)
 16728  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 16729  		return (*string)(&vt.Name)
 16730  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 16731  		return (*string)(&vt.Name)
 16732  	} else if vt := u.OfAdvisorTool20260301; vt != nil {
 16733  		return (*string)(&vt.Name)
 16734  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil {
 16735  		return (*string)(&vt.Name)
 16736  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil {
 16737  		return (*string)(&vt.Name)
 16738  	}
 16739  	return nil
 16740  }
 16741  
 16742  // Returns a pointer to the underlying variant's property, if present.
 16743  func (u BetaMessageCountTokensParamsToolUnion) GetDeferLoading() *bool {
 16744  	if vt := u.OfTool; vt != nil && vt.DeferLoading.Valid() {
 16745  		return &vt.DeferLoading.Value
 16746  	} else if vt := u.OfBashTool20241022; vt != nil && vt.DeferLoading.Valid() {
 16747  		return &vt.DeferLoading.Value
 16748  	} else if vt := u.OfBashTool20250124; vt != nil && vt.DeferLoading.Valid() {
 16749  		return &vt.DeferLoading.Value
 16750  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil && vt.DeferLoading.Valid() {
 16751  		return &vt.DeferLoading.Value
 16752  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil && vt.DeferLoading.Valid() {
 16753  		return &vt.DeferLoading.Value
 16754  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil && vt.DeferLoading.Valid() {
 16755  		return &vt.DeferLoading.Value
 16756  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil && vt.DeferLoading.Valid() {
 16757  		return &vt.DeferLoading.Value
 16758  	} else if vt := u.OfComputerUseTool20241022; vt != nil && vt.DeferLoading.Valid() {
 16759  		return &vt.DeferLoading.Value
 16760  	} else if vt := u.OfMemoryTool20250818; vt != nil && vt.DeferLoading.Valid() {
 16761  		return &vt.DeferLoading.Value
 16762  	} else if vt := u.OfComputerUseTool20250124; vt != nil && vt.DeferLoading.Valid() {
 16763  		return &vt.DeferLoading.Value
 16764  	} else if vt := u.OfTextEditor20241022; vt != nil && vt.DeferLoading.Valid() {
 16765  		return &vt.DeferLoading.Value
 16766  	} else if vt := u.OfComputerUseTool20251124; vt != nil && vt.DeferLoading.Valid() {
 16767  		return &vt.DeferLoading.Value
 16768  	} else if vt := u.OfTextEditor20250124; vt != nil && vt.DeferLoading.Valid() {
 16769  		return &vt.DeferLoading.Value
 16770  	} else if vt := u.OfTextEditor20250429; vt != nil && vt.DeferLoading.Valid() {
 16771  		return &vt.DeferLoading.Value
 16772  	} else if vt := u.OfTextEditor20250728; vt != nil && vt.DeferLoading.Valid() {
 16773  		return &vt.DeferLoading.Value
 16774  	} else if vt := u.OfWebSearchTool20250305; vt != nil && vt.DeferLoading.Valid() {
 16775  		return &vt.DeferLoading.Value
 16776  	} else if vt := u.OfWebFetchTool20250910; vt != nil && vt.DeferLoading.Valid() {
 16777  		return &vt.DeferLoading.Value
 16778  	} else if vt := u.OfWebSearchTool20260209; vt != nil && vt.DeferLoading.Valid() {
 16779  		return &vt.DeferLoading.Value
 16780  	} else if vt := u.OfWebFetchTool20260209; vt != nil && vt.DeferLoading.Valid() {
 16781  		return &vt.DeferLoading.Value
 16782  	} else if vt := u.OfWebFetchTool20260309; vt != nil && vt.DeferLoading.Valid() {
 16783  		return &vt.DeferLoading.Value
 16784  	} else if vt := u.OfWebSearchTool20260318; vt != nil && vt.DeferLoading.Valid() {
 16785  		return &vt.DeferLoading.Value
 16786  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.DeferLoading.Valid() {
 16787  		return &vt.DeferLoading.Value
 16788  	} else if vt := u.OfAdvisorTool20260301; vt != nil && vt.DeferLoading.Valid() {
 16789  		return &vt.DeferLoading.Value
 16790  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil && vt.DeferLoading.Valid() {
 16791  		return &vt.DeferLoading.Value
 16792  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil && vt.DeferLoading.Valid() {
 16793  		return &vt.DeferLoading.Value
 16794  	}
 16795  	return nil
 16796  }
 16797  
 16798  // Returns a pointer to the underlying variant's property, if present.
 16799  func (u BetaMessageCountTokensParamsToolUnion) GetStrict() *bool {
 16800  	if vt := u.OfTool; vt != nil && vt.Strict.Valid() {
 16801  		return &vt.Strict.Value
 16802  	} else if vt := u.OfBashTool20241022; vt != nil && vt.Strict.Valid() {
 16803  		return &vt.Strict.Value
 16804  	} else if vt := u.OfBashTool20250124; vt != nil && vt.Strict.Valid() {
 16805  		return &vt.Strict.Value
 16806  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil && vt.Strict.Valid() {
 16807  		return &vt.Strict.Value
 16808  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil && vt.Strict.Valid() {
 16809  		return &vt.Strict.Value
 16810  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil && vt.Strict.Valid() {
 16811  		return &vt.Strict.Value
 16812  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil && vt.Strict.Valid() {
 16813  		return &vt.Strict.Value
 16814  	} else if vt := u.OfComputerUseTool20241022; vt != nil && vt.Strict.Valid() {
 16815  		return &vt.Strict.Value
 16816  	} else if vt := u.OfMemoryTool20250818; vt != nil && vt.Strict.Valid() {
 16817  		return &vt.Strict.Value
 16818  	} else if vt := u.OfComputerUseTool20250124; vt != nil && vt.Strict.Valid() {
 16819  		return &vt.Strict.Value
 16820  	} else if vt := u.OfTextEditor20241022; vt != nil && vt.Strict.Valid() {
 16821  		return &vt.Strict.Value
 16822  	} else if vt := u.OfComputerUseTool20251124; vt != nil && vt.Strict.Valid() {
 16823  		return &vt.Strict.Value
 16824  	} else if vt := u.OfTextEditor20250124; vt != nil && vt.Strict.Valid() {
 16825  		return &vt.Strict.Value
 16826  	} else if vt := u.OfTextEditor20250429; vt != nil && vt.Strict.Valid() {
 16827  		return &vt.Strict.Value
 16828  	} else if vt := u.OfTextEditor20250728; vt != nil && vt.Strict.Valid() {
 16829  		return &vt.Strict.Value
 16830  	} else if vt := u.OfWebSearchTool20250305; vt != nil && vt.Strict.Valid() {
 16831  		return &vt.Strict.Value
 16832  	} else if vt := u.OfWebFetchTool20250910; vt != nil && vt.Strict.Valid() {
 16833  		return &vt.Strict.Value
 16834  	} else if vt := u.OfWebSearchTool20260209; vt != nil && vt.Strict.Valid() {
 16835  		return &vt.Strict.Value
 16836  	} else if vt := u.OfWebFetchTool20260209; vt != nil && vt.Strict.Valid() {
 16837  		return &vt.Strict.Value
 16838  	} else if vt := u.OfWebFetchTool20260309; vt != nil && vt.Strict.Valid() {
 16839  		return &vt.Strict.Value
 16840  	} else if vt := u.OfWebSearchTool20260318; vt != nil && vt.Strict.Valid() {
 16841  		return &vt.Strict.Value
 16842  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.Strict.Valid() {
 16843  		return &vt.Strict.Value
 16844  	} else if vt := u.OfAdvisorTool20260301; vt != nil && vt.Strict.Valid() {
 16845  		return &vt.Strict.Value
 16846  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil && vt.Strict.Valid() {
 16847  		return &vt.Strict.Value
 16848  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil && vt.Strict.Valid() {
 16849  		return &vt.Strict.Value
 16850  	}
 16851  	return nil
 16852  }
 16853  
 16854  // Returns a pointer to the underlying variant's property, if present.
 16855  func (u BetaMessageCountTokensParamsToolUnion) GetType() *string {
 16856  	if vt := u.OfTool; vt != nil {
 16857  		return (*string)(&vt.Type)
 16858  	} else if vt := u.OfBashTool20241022; vt != nil {
 16859  		return (*string)(&vt.Type)
 16860  	} else if vt := u.OfBashTool20250124; vt != nil {
 16861  		return (*string)(&vt.Type)
 16862  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil {
 16863  		return (*string)(&vt.Type)
 16864  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil {
 16865  		return (*string)(&vt.Type)
 16866  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil {
 16867  		return (*string)(&vt.Type)
 16868  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil {
 16869  		return (*string)(&vt.Type)
 16870  	} else if vt := u.OfBrowserToolset20260801; vt != nil {
 16871  		return (*string)(&vt.Type)
 16872  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 16873  		return (*string)(&vt.Type)
 16874  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 16875  		return (*string)(&vt.Type)
 16876  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 16877  		return (*string)(&vt.Type)
 16878  	} else if vt := u.OfTextEditor20241022; vt != nil {
 16879  		return (*string)(&vt.Type)
 16880  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 16881  		return (*string)(&vt.Type)
 16882  	} else if vt := u.OfComputerToolset20260801; vt != nil {
 16883  		return (*string)(&vt.Type)
 16884  	} else if vt := u.OfTextEditor20250124; vt != nil {
 16885  		return (*string)(&vt.Type)
 16886  	} else if vt := u.OfTextEditor20250429; vt != nil {
 16887  		return (*string)(&vt.Type)
 16888  	} else if vt := u.OfTextEditor20250728; vt != nil {
 16889  		return (*string)(&vt.Type)
 16890  	} else if vt := u.OfWebSearchTool20250305; vt != nil {
 16891  		return (*string)(&vt.Type)
 16892  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 16893  		return (*string)(&vt.Type)
 16894  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 16895  		return (*string)(&vt.Type)
 16896  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 16897  		return (*string)(&vt.Type)
 16898  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 16899  		return (*string)(&vt.Type)
 16900  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 16901  		return (*string)(&vt.Type)
 16902  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 16903  		return (*string)(&vt.Type)
 16904  	} else if vt := u.OfAdvisorTool20260301; vt != nil {
 16905  		return (*string)(&vt.Type)
 16906  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil {
 16907  		return (*string)(&vt.Type)
 16908  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil {
 16909  		return (*string)(&vt.Type)
 16910  	} else if vt := u.OfMCPToolset; vt != nil {
 16911  		return (*string)(&vt.Type)
 16912  	}
 16913  	return nil
 16914  }
 16915  
 16916  // Returns a pointer to the underlying variant's property, if present.
 16917  func (u BetaMessageCountTokensParamsToolUnion) GetDisplayHeightPx() *int64 {
 16918  	if vt := u.OfComputerUseTool20241022; vt != nil {
 16919  		return (*int64)(&vt.DisplayHeightPx)
 16920  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 16921  		return (*int64)(&vt.DisplayHeightPx)
 16922  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 16923  		return (*int64)(&vt.DisplayHeightPx)
 16924  	}
 16925  	return nil
 16926  }
 16927  
 16928  // Returns a pointer to the underlying variant's property, if present.
 16929  func (u BetaMessageCountTokensParamsToolUnion) GetDisplayWidthPx() *int64 {
 16930  	if vt := u.OfComputerUseTool20241022; vt != nil {
 16931  		return (*int64)(&vt.DisplayWidthPx)
 16932  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 16933  		return (*int64)(&vt.DisplayWidthPx)
 16934  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 16935  		return (*int64)(&vt.DisplayWidthPx)
 16936  	}
 16937  	return nil
 16938  }
 16939  
 16940  // Returns a pointer to the underlying variant's property, if present.
 16941  func (u BetaMessageCountTokensParamsToolUnion) GetDisplayNumber() *int64 {
 16942  	if vt := u.OfComputerUseTool20241022; vt != nil && vt.DisplayNumber.Valid() {
 16943  		return &vt.DisplayNumber.Value
 16944  	} else if vt := u.OfComputerUseTool20250124; vt != nil && vt.DisplayNumber.Valid() {
 16945  		return &vt.DisplayNumber.Value
 16946  	} else if vt := u.OfComputerUseTool20251124; vt != nil && vt.DisplayNumber.Valid() {
 16947  		return &vt.DisplayNumber.Value
 16948  	}
 16949  	return nil
 16950  }
 16951  
 16952  // Returns a pointer to the underlying variant's property, if present.
 16953  func (u BetaMessageCountTokensParamsToolUnion) GetMaxUses() *int64 {
 16954  	if vt := u.OfWebSearchTool20250305; vt != nil && vt.MaxUses.Valid() {
 16955  		return &vt.MaxUses.Value
 16956  	} else if vt := u.OfWebFetchTool20250910; vt != nil && vt.MaxUses.Valid() {
 16957  		return &vt.MaxUses.Value
 16958  	} else if vt := u.OfWebSearchTool20260209; vt != nil && vt.MaxUses.Valid() {
 16959  		return &vt.MaxUses.Value
 16960  	} else if vt := u.OfWebFetchTool20260209; vt != nil && vt.MaxUses.Valid() {
 16961  		return &vt.MaxUses.Value
 16962  	} else if vt := u.OfWebFetchTool20260309; vt != nil && vt.MaxUses.Valid() {
 16963  		return &vt.MaxUses.Value
 16964  	} else if vt := u.OfWebSearchTool20260318; vt != nil && vt.MaxUses.Valid() {
 16965  		return &vt.MaxUses.Value
 16966  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.MaxUses.Valid() {
 16967  		return &vt.MaxUses.Value
 16968  	} else if vt := u.OfAdvisorTool20260301; vt != nil && vt.MaxUses.Valid() {
 16969  		return &vt.MaxUses.Value
 16970  	}
 16971  	return nil
 16972  }
 16973  
 16974  // Returns a pointer to the underlying variant's property, if present.
 16975  func (u BetaMessageCountTokensParamsToolUnion) GetMaxContentTokens() *int64 {
 16976  	if vt := u.OfWebFetchTool20250910; vt != nil && vt.MaxContentTokens.Valid() {
 16977  		return &vt.MaxContentTokens.Value
 16978  	} else if vt := u.OfWebFetchTool20260209; vt != nil && vt.MaxContentTokens.Valid() {
 16979  		return &vt.MaxContentTokens.Value
 16980  	} else if vt := u.OfWebFetchTool20260309; vt != nil && vt.MaxContentTokens.Valid() {
 16981  		return &vt.MaxContentTokens.Value
 16982  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.MaxContentTokens.Valid() {
 16983  		return &vt.MaxContentTokens.Value
 16984  	}
 16985  	return nil
 16986  }
 16987  
 16988  // Returns a pointer to the underlying variant's property, if present.
 16989  func (u BetaMessageCountTokensParamsToolUnion) GetUseCache() *bool {
 16990  	if vt := u.OfWebFetchTool20260309; vt != nil && vt.UseCache.Valid() {
 16991  		return &vt.UseCache.Value
 16992  	} else if vt := u.OfWebFetchTool20260318; vt != nil && vt.UseCache.Valid() {
 16993  		return &vt.UseCache.Value
 16994  	}
 16995  	return nil
 16996  }
 16997  
 16998  // Returns a pointer to the underlying variant's property, if present.
 16999  func (u BetaMessageCountTokensParamsToolUnion) GetResponseInclusion() *string {
 17000  	if vt := u.OfWebSearchTool20260318; vt != nil {
 17001  		return (*string)(&vt.ResponseInclusion)
 17002  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 17003  		return (*string)(&vt.ResponseInclusion)
 17004  	}
 17005  	return nil
 17006  }
 17007  
 17008  // Returns a pointer to the underlying variant's AllowedCallers property, if
 17009  // present.
 17010  func (u BetaMessageCountTokensParamsToolUnion) GetAllowedCallers() []string {
 17011  	if vt := u.OfTool; vt != nil {
 17012  		return vt.AllowedCallers
 17013  	} else if vt := u.OfBashTool20241022; vt != nil {
 17014  		return vt.AllowedCallers
 17015  	} else if vt := u.OfBashTool20250124; vt != nil {
 17016  		return vt.AllowedCallers
 17017  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil {
 17018  		return vt.AllowedCallers
 17019  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil {
 17020  		return vt.AllowedCallers
 17021  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil {
 17022  		return vt.AllowedCallers
 17023  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil {
 17024  		return vt.AllowedCallers
 17025  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 17026  		return vt.AllowedCallers
 17027  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 17028  		return vt.AllowedCallers
 17029  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 17030  		return vt.AllowedCallers
 17031  	} else if vt := u.OfTextEditor20241022; vt != nil {
 17032  		return vt.AllowedCallers
 17033  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 17034  		return vt.AllowedCallers
 17035  	} else if vt := u.OfTextEditor20250124; vt != nil {
 17036  		return vt.AllowedCallers
 17037  	} else if vt := u.OfTextEditor20250429; vt != nil {
 17038  		return vt.AllowedCallers
 17039  	} else if vt := u.OfTextEditor20250728; vt != nil {
 17040  		return vt.AllowedCallers
 17041  	} else if vt := u.OfWebSearchTool20250305; vt != nil {
 17042  		return vt.AllowedCallers
 17043  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 17044  		return vt.AllowedCallers
 17045  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 17046  		return vt.AllowedCallers
 17047  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 17048  		return vt.AllowedCallers
 17049  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 17050  		return vt.AllowedCallers
 17051  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 17052  		return vt.AllowedCallers
 17053  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 17054  		return vt.AllowedCallers
 17055  	} else if vt := u.OfAdvisorTool20260301; vt != nil {
 17056  		return vt.AllowedCallers
 17057  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil {
 17058  		return vt.AllowedCallers
 17059  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil {
 17060  		return vt.AllowedCallers
 17061  	}
 17062  	return nil
 17063  }
 17064  
 17065  // Returns a pointer to the underlying variant's CacheControl property, if present.
 17066  func (u BetaMessageCountTokensParamsToolUnion) GetCacheControl() *BetaCacheControlEphemeralParam {
 17067  	if vt := u.OfTool; vt != nil {
 17068  		return &vt.CacheControl
 17069  	} else if vt := u.OfBashTool20241022; vt != nil {
 17070  		return &vt.CacheControl
 17071  	} else if vt := u.OfBashTool20250124; vt != nil {
 17072  		return &vt.CacheControl
 17073  	} else if vt := u.OfCodeExecutionTool20250522; vt != nil {
 17074  		return &vt.CacheControl
 17075  	} else if vt := u.OfCodeExecutionTool20250825; vt != nil {
 17076  		return &vt.CacheControl
 17077  	} else if vt := u.OfCodeExecutionTool20260120; vt != nil {
 17078  		return &vt.CacheControl
 17079  	} else if vt := u.OfCodeExecutionTool20260521; vt != nil {
 17080  		return &vt.CacheControl
 17081  	} else if vt := u.OfBrowserToolset20260801; vt != nil {
 17082  		return &vt.CacheControl
 17083  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 17084  		return &vt.CacheControl
 17085  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 17086  		return &vt.CacheControl
 17087  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 17088  		return &vt.CacheControl
 17089  	} else if vt := u.OfTextEditor20241022; vt != nil {
 17090  		return &vt.CacheControl
 17091  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 17092  		return &vt.CacheControl
 17093  	} else if vt := u.OfComputerToolset20260801; vt != nil {
 17094  		return &vt.CacheControl
 17095  	} else if vt := u.OfTextEditor20250124; vt != nil {
 17096  		return &vt.CacheControl
 17097  	} else if vt := u.OfTextEditor20250429; vt != nil {
 17098  		return &vt.CacheControl
 17099  	} else if vt := u.OfTextEditor20250728; vt != nil {
 17100  		return &vt.CacheControl
 17101  	} else if vt := u.OfWebSearchTool20250305; vt != nil {
 17102  		return &vt.CacheControl
 17103  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 17104  		return &vt.CacheControl
 17105  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 17106  		return &vt.CacheControl
 17107  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 17108  		return &vt.CacheControl
 17109  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 17110  		return &vt.CacheControl
 17111  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 17112  		return &vt.CacheControl
 17113  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 17114  		return &vt.CacheControl
 17115  	} else if vt := u.OfAdvisorTool20260301; vt != nil {
 17116  		return &vt.CacheControl
 17117  	} else if vt := u.OfToolSearchToolBm25_20251119; vt != nil {
 17118  		return &vt.CacheControl
 17119  	} else if vt := u.OfToolSearchToolRegex20251119; vt != nil {
 17120  		return &vt.CacheControl
 17121  	} else if vt := u.OfMCPToolset; vt != nil {
 17122  		return &vt.CacheControl
 17123  	}
 17124  	return nil
 17125  }
 17126  
 17127  // Returns a pointer to the underlying variant's InputExamples property, if
 17128  // present.
 17129  func (u BetaMessageCountTokensParamsToolUnion) GetInputExamples() []map[string]any {
 17130  	if vt := u.OfTool; vt != nil {
 17131  		return vt.InputExamples
 17132  	} else if vt := u.OfBashTool20241022; vt != nil {
 17133  		return vt.InputExamples
 17134  	} else if vt := u.OfBashTool20250124; vt != nil {
 17135  		return vt.InputExamples
 17136  	} else if vt := u.OfComputerUseTool20241022; vt != nil {
 17137  		return vt.InputExamples
 17138  	} else if vt := u.OfMemoryTool20250818; vt != nil {
 17139  		return vt.InputExamples
 17140  	} else if vt := u.OfComputerUseTool20250124; vt != nil {
 17141  		return vt.InputExamples
 17142  	} else if vt := u.OfTextEditor20241022; vt != nil {
 17143  		return vt.InputExamples
 17144  	} else if vt := u.OfComputerUseTool20251124; vt != nil {
 17145  		return vt.InputExamples
 17146  	} else if vt := u.OfTextEditor20250124; vt != nil {
 17147  		return vt.InputExamples
 17148  	} else if vt := u.OfTextEditor20250429; vt != nil {
 17149  		return vt.InputExamples
 17150  	} else if vt := u.OfTextEditor20250728; vt != nil {
 17151  		return vt.InputExamples
 17152  	}
 17153  	return nil
 17154  }
 17155  
 17156  // Returns a subunion which exports methods to access subproperties
 17157  //
 17158  // Or use AsAny() to get the underlying value
 17159  func (u BetaMessageCountTokensParamsToolUnion) GetConfigs() (res betaMessageCountTokensParamsToolUnionConfigs) {
 17160  	if vt := u.OfBrowserToolset20260801; vt != nil {
 17161  		res.any = &vt.Configs
 17162  	} else if vt := u.OfComputerToolset20260801; vt != nil {
 17163  		res.any = &vt.Configs
 17164  	} else if vt := u.OfMCPToolset; vt != nil {
 17165  		res.any = &vt.Configs
 17166  	}
 17167  	return
 17168  }
 17169  
 17170  // Can have the runtime types [*BetaBrowserToolsetConfigsParam],
 17171  // [*BetaComputerToolsetConfigsParam], [\*map[string]BetaMCPToolConfigParam]
 17172  type betaMessageCountTokensParamsToolUnionConfigs struct{ any }
 17173  
 17174  // Use the following switch statement to get the type of the union:
 17175  //
 17176  //	switch u.AsAny().(type) {
 17177  //	case *anthropic.BetaBrowserToolsetConfigsParam:
 17178  //	case *anthropic.BetaComputerToolsetConfigsParam:
 17179  //	case *map[string]anthropic.BetaMCPToolConfigParam:
 17180  //	default:
 17181  //	    fmt.Errorf("not present")
 17182  //	}
 17183  func (u betaMessageCountTokensParamsToolUnionConfigs) AsAny() any { return u.any }
 17184  
 17185  // Returns a pointer to the underlying variant's property, if present.
 17186  func (u betaMessageCountTokensParamsToolUnionConfigs) GetCloseTab() *BetaBrowserCloseTabConfigParam {
 17187  	switch vt := u.any.(type) {
 17188  	case *BetaBrowserToolsetConfigsParam:
 17189  		return &vt.CloseTab
 17190  	}
 17191  	return nil
 17192  }
 17193  
 17194  // Returns a pointer to the underlying variant's property, if present.
 17195  func (u betaMessageCountTokensParamsToolUnionConfigs) GetFileUpload() *BetaBrowserFileUploadConfigParam {
 17196  	switch vt := u.any.(type) {
 17197  	case *BetaBrowserToolsetConfigsParam:
 17198  		return &vt.FileUpload
 17199  	}
 17200  	return nil
 17201  }
 17202  
 17203  // Returns a pointer to the underlying variant's property, if present.
 17204  func (u betaMessageCountTokensParamsToolUnionConfigs) GetFind() *BetaBrowserFindConfigParam {
 17205  	switch vt := u.any.(type) {
 17206  	case *BetaBrowserToolsetConfigsParam:
 17207  		return &vt.Find
 17208  	}
 17209  	return nil
 17210  }
 17211  
 17212  // Returns a pointer to the underlying variant's property, if present.
 17213  func (u betaMessageCountTokensParamsToolUnionConfigs) GetFormInput() *BetaBrowserFormInputConfigParam {
 17214  	switch vt := u.any.(type) {
 17215  	case *BetaBrowserToolsetConfigsParam:
 17216  		return &vt.FormInput
 17217  	}
 17218  	return nil
 17219  }
 17220  
 17221  // Returns a pointer to the underlying variant's property, if present.
 17222  func (u betaMessageCountTokensParamsToolUnionConfigs) GetGetPageText() *BetaBrowserGetPageTextConfigParam {
 17223  	switch vt := u.any.(type) {
 17224  	case *BetaBrowserToolsetConfigsParam:
 17225  		return &vt.GetPageText
 17226  	}
 17227  	return nil
 17228  }
 17229  
 17230  // Returns a pointer to the underlying variant's property, if present.
 17231  func (u betaMessageCountTokensParamsToolUnionConfigs) GetHover() *BetaBrowserHoverConfigParam {
 17232  	switch vt := u.any.(type) {
 17233  	case *BetaBrowserToolsetConfigsParam:
 17234  		return &vt.Hover
 17235  	}
 17236  	return nil
 17237  }
 17238  
 17239  // Returns a pointer to the underlying variant's property, if present.
 17240  func (u betaMessageCountTokensParamsToolUnionConfigs) GetJavascriptExec() *BetaBrowserJavascriptExecConfigParam {
 17241  	switch vt := u.any.(type) {
 17242  	case *BetaBrowserToolsetConfigsParam:
 17243  		return &vt.JavascriptExec
 17244  	}
 17245  	return nil
 17246  }
 17247  
 17248  // Returns a pointer to the underlying variant's property, if present.
 17249  func (u betaMessageCountTokensParamsToolUnionConfigs) GetListTabs() *BetaBrowserListTabsConfigParam {
 17250  	switch vt := u.any.(type) {
 17251  	case *BetaBrowserToolsetConfigsParam:
 17252  		return &vt.ListTabs
 17253  	}
 17254  	return nil
 17255  }
 17256  
 17257  // Returns a pointer to the underlying variant's property, if present.
 17258  func (u betaMessageCountTokensParamsToolUnionConfigs) GetNavigate() *BetaBrowserNavigateConfigParam {
 17259  	switch vt := u.any.(type) {
 17260  	case *BetaBrowserToolsetConfigsParam:
 17261  		return &vt.Navigate
 17262  	}
 17263  	return nil
 17264  }
 17265  
 17266  // Returns a pointer to the underlying variant's property, if present.
 17267  func (u betaMessageCountTokensParamsToolUnionConfigs) GetNewTab() *BetaBrowserNewTabConfigParam {
 17268  	switch vt := u.any.(type) {
 17269  	case *BetaBrowserToolsetConfigsParam:
 17270  		return &vt.NewTab
 17271  	}
 17272  	return nil
 17273  }
 17274  
 17275  // Returns a pointer to the underlying variant's property, if present.
 17276  func (u betaMessageCountTokensParamsToolUnionConfigs) GetReadConsole() *BetaBrowserReadConsoleConfigParam {
 17277  	switch vt := u.any.(type) {
 17278  	case *BetaBrowserToolsetConfigsParam:
 17279  		return &vt.ReadConsole
 17280  	}
 17281  	return nil
 17282  }
 17283  
 17284  // Returns a pointer to the underlying variant's property, if present.
 17285  func (u betaMessageCountTokensParamsToolUnionConfigs) GetReadNetwork() *BetaBrowserReadNetworkConfigParam {
 17286  	switch vt := u.any.(type) {
 17287  	case *BetaBrowserToolsetConfigsParam:
 17288  		return &vt.ReadNetwork
 17289  	}
 17290  	return nil
 17291  }
 17292  
 17293  // Returns a pointer to the underlying variant's property, if present.
 17294  func (u betaMessageCountTokensParamsToolUnionConfigs) GetReadPage() *BetaBrowserReadPageConfigParam {
 17295  	switch vt := u.any.(type) {
 17296  	case *BetaBrowserToolsetConfigsParam:
 17297  		return &vt.ReadPage
 17298  	}
 17299  	return nil
 17300  }
 17301  
 17302  // Returns a pointer to the underlying variant's property, if present.
 17303  func (u betaMessageCountTokensParamsToolUnionConfigs) GetScrollTo() *BetaBrowserScrollToConfigParam {
 17304  	switch vt := u.any.(type) {
 17305  	case *BetaBrowserToolsetConfigsParam:
 17306  		return &vt.ScrollTo
 17307  	}
 17308  	return nil
 17309  }
 17310  
 17311  // Returns a pointer to the underlying variant's property, if present.
 17312  func (u betaMessageCountTokensParamsToolUnionConfigs) GetSwitchTab() *BetaBrowserSwitchTabConfigParam {
 17313  	switch vt := u.any.(type) {
 17314  	case *BetaBrowserToolsetConfigsParam:
 17315  		return &vt.SwitchTab
 17316  	}
 17317  	return nil
 17318  }
 17319  
 17320  // Returns a pointer to the underlying variant's property, if present.
 17321  func (u betaMessageCountTokensParamsToolUnionConfigs) GetCursorPosition() *BetaComputerCursorPositionConfigParam {
 17322  	switch vt := u.any.(type) {
 17323  	case *BetaComputerToolsetConfigsParam:
 17324  		return &vt.CursorPosition
 17325  	}
 17326  	return nil
 17327  }
 17328  
 17329  // Returns a subunion which exports methods to access subproperties
 17330  //
 17331  // Or use AsAny() to get the underlying value
 17332  func (u betaMessageCountTokensParamsToolUnionConfigs) GetDoubleClick() (res betaMessageCountTokensParamsToolUnionConfigsDoubleClick) {
 17333  	switch vt := u.any.(type) {
 17334  	case *BetaBrowserToolsetConfigsParam:
 17335  		res.any = &vt.DoubleClick
 17336  	case *BetaComputerToolsetConfigsParam:
 17337  		res.any = &vt.DoubleClick
 17338  	}
 17339  	return res
 17340  }
 17341  
 17342  // Can have the runtime types [*BetaBrowserDoubleClickConfigParam],
 17343  // [*BetaComputerDoubleClickConfigParam]
 17344  type betaMessageCountTokensParamsToolUnionConfigsDoubleClick struct{ any }
 17345  
 17346  // Use the following switch statement to get the type of the union:
 17347  //
 17348  //	switch u.AsAny().(type) {
 17349  //	case *anthropic.BetaBrowserDoubleClickConfigParam:
 17350  //	case *anthropic.BetaComputerDoubleClickConfigParam:
 17351  //	default:
 17352  //	    fmt.Errorf("not present")
 17353  //	}
 17354  func (u betaMessageCountTokensParamsToolUnionConfigsDoubleClick) AsAny() any { return u.any }
 17355  
 17356  // Returns a pointer to the underlying variant's property, if present.
 17357  func (u betaMessageCountTokensParamsToolUnionConfigsDoubleClick) GetDeferLoading() *bool {
 17358  	switch vt := u.any.(type) {
 17359  	case *BetaBrowserDoubleClickConfigParam:
 17360  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17361  	case *BetaComputerDoubleClickConfigParam:
 17362  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17363  	}
 17364  	return nil
 17365  }
 17366  
 17367  // Returns a pointer to the underlying variant's property, if present.
 17368  func (u betaMessageCountTokensParamsToolUnionConfigsDoubleClick) GetEnabled() *bool {
 17369  	switch vt := u.any.(type) {
 17370  	case *BetaBrowserDoubleClickConfigParam:
 17371  		return paramutil.AddrIfPresent(vt.Enabled)
 17372  	case *BetaComputerDoubleClickConfigParam:
 17373  		return paramutil.AddrIfPresent(vt.Enabled)
 17374  	}
 17375  	return nil
 17376  }
 17377  
 17378  // Returns a subunion which exports methods to access subproperties
 17379  //
 17380  // Or use AsAny() to get the underlying value
 17381  func (u betaMessageCountTokensParamsToolUnionConfigs) GetHoldKey() (res betaMessageCountTokensParamsToolUnionConfigsHoldKey) {
 17382  	switch vt := u.any.(type) {
 17383  	case *BetaBrowserToolsetConfigsParam:
 17384  		res.any = &vt.HoldKey
 17385  	case *BetaComputerToolsetConfigsParam:
 17386  		res.any = &vt.HoldKey
 17387  	}
 17388  	return res
 17389  }
 17390  
 17391  // Can have the runtime types [*BetaBrowserHoldKeyConfigParam],
 17392  // [*BetaComputerHoldKeyConfigParam]
 17393  type betaMessageCountTokensParamsToolUnionConfigsHoldKey struct{ any }
 17394  
 17395  // Use the following switch statement to get the type of the union:
 17396  //
 17397  //	switch u.AsAny().(type) {
 17398  //	case *anthropic.BetaBrowserHoldKeyConfigParam:
 17399  //	case *anthropic.BetaComputerHoldKeyConfigParam:
 17400  //	default:
 17401  //	    fmt.Errorf("not present")
 17402  //	}
 17403  func (u betaMessageCountTokensParamsToolUnionConfigsHoldKey) AsAny() any { return u.any }
 17404  
 17405  // Returns a pointer to the underlying variant's property, if present.
 17406  func (u betaMessageCountTokensParamsToolUnionConfigsHoldKey) GetDeferLoading() *bool {
 17407  	switch vt := u.any.(type) {
 17408  	case *BetaBrowserHoldKeyConfigParam:
 17409  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17410  	case *BetaComputerHoldKeyConfigParam:
 17411  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17412  	}
 17413  	return nil
 17414  }
 17415  
 17416  // Returns a pointer to the underlying variant's property, if present.
 17417  func (u betaMessageCountTokensParamsToolUnionConfigsHoldKey) GetEnabled() *bool {
 17418  	switch vt := u.any.(type) {
 17419  	case *BetaBrowserHoldKeyConfigParam:
 17420  		return paramutil.AddrIfPresent(vt.Enabled)
 17421  	case *BetaComputerHoldKeyConfigParam:
 17422  		return paramutil.AddrIfPresent(vt.Enabled)
 17423  	}
 17424  	return nil
 17425  }
 17426  
 17427  // Returns a subunion which exports methods to access subproperties
 17428  //
 17429  // Or use AsAny() to get the underlying value
 17430  func (u betaMessageCountTokensParamsToolUnionConfigs) GetKey() (res betaMessageCountTokensParamsToolUnionConfigsKey) {
 17431  	switch vt := u.any.(type) {
 17432  	case *BetaBrowserToolsetConfigsParam:
 17433  		res.any = &vt.Key
 17434  	case *BetaComputerToolsetConfigsParam:
 17435  		res.any = &vt.Key
 17436  	}
 17437  	return res
 17438  }
 17439  
 17440  // Can have the runtime types [*BetaBrowserKeyConfigParam],
 17441  // [*BetaComputerKeyConfigParam]
 17442  type betaMessageCountTokensParamsToolUnionConfigsKey struct{ any }
 17443  
 17444  // Use the following switch statement to get the type of the union:
 17445  //
 17446  //	switch u.AsAny().(type) {
 17447  //	case *anthropic.BetaBrowserKeyConfigParam:
 17448  //	case *anthropic.BetaComputerKeyConfigParam:
 17449  //	default:
 17450  //	    fmt.Errorf("not present")
 17451  //	}
 17452  func (u betaMessageCountTokensParamsToolUnionConfigsKey) AsAny() any { return u.any }
 17453  
 17454  // Returns a pointer to the underlying variant's property, if present.
 17455  func (u betaMessageCountTokensParamsToolUnionConfigsKey) GetDeferLoading() *bool {
 17456  	switch vt := u.any.(type) {
 17457  	case *BetaBrowserKeyConfigParam:
 17458  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17459  	case *BetaComputerKeyConfigParam:
 17460  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17461  	}
 17462  	return nil
 17463  }
 17464  
 17465  // Returns a pointer to the underlying variant's property, if present.
 17466  func (u betaMessageCountTokensParamsToolUnionConfigsKey) GetEnabled() *bool {
 17467  	switch vt := u.any.(type) {
 17468  	case *BetaBrowserKeyConfigParam:
 17469  		return paramutil.AddrIfPresent(vt.Enabled)
 17470  	case *BetaComputerKeyConfigParam:
 17471  		return paramutil.AddrIfPresent(vt.Enabled)
 17472  	}
 17473  	return nil
 17474  }
 17475  
 17476  // Returns a subunion which exports methods to access subproperties
 17477  //
 17478  // Or use AsAny() to get the underlying value
 17479  func (u betaMessageCountTokensParamsToolUnionConfigs) GetLeftClick() (res betaMessageCountTokensParamsToolUnionConfigsLeftClick) {
 17480  	switch vt := u.any.(type) {
 17481  	case *BetaBrowserToolsetConfigsParam:
 17482  		res.any = &vt.LeftClick
 17483  	case *BetaComputerToolsetConfigsParam:
 17484  		res.any = &vt.LeftClick
 17485  	}
 17486  	return res
 17487  }
 17488  
 17489  // Can have the runtime types [*BetaBrowserLeftClickConfigParam],
 17490  // [*BetaComputerLeftClickConfigParam]
 17491  type betaMessageCountTokensParamsToolUnionConfigsLeftClick struct{ any }
 17492  
 17493  // Use the following switch statement to get the type of the union:
 17494  //
 17495  //	switch u.AsAny().(type) {
 17496  //	case *anthropic.BetaBrowserLeftClickConfigParam:
 17497  //	case *anthropic.BetaComputerLeftClickConfigParam:
 17498  //	default:
 17499  //	    fmt.Errorf("not present")
 17500  //	}
 17501  func (u betaMessageCountTokensParamsToolUnionConfigsLeftClick) AsAny() any { return u.any }
 17502  
 17503  // Returns a pointer to the underlying variant's property, if present.
 17504  func (u betaMessageCountTokensParamsToolUnionConfigsLeftClick) GetDeferLoading() *bool {
 17505  	switch vt := u.any.(type) {
 17506  	case *BetaBrowserLeftClickConfigParam:
 17507  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17508  	case *BetaComputerLeftClickConfigParam:
 17509  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17510  	}
 17511  	return nil
 17512  }
 17513  
 17514  // Returns a pointer to the underlying variant's property, if present.
 17515  func (u betaMessageCountTokensParamsToolUnionConfigsLeftClick) GetEnabled() *bool {
 17516  	switch vt := u.any.(type) {
 17517  	case *BetaBrowserLeftClickConfigParam:
 17518  		return paramutil.AddrIfPresent(vt.Enabled)
 17519  	case *BetaComputerLeftClickConfigParam:
 17520  		return paramutil.AddrIfPresent(vt.Enabled)
 17521  	}
 17522  	return nil
 17523  }
 17524  
 17525  // Returns a subunion which exports methods to access subproperties
 17526  //
 17527  // Or use AsAny() to get the underlying value
 17528  func (u betaMessageCountTokensParamsToolUnionConfigs) GetLeftClickDrag() (res betaMessageCountTokensParamsToolUnionConfigsLeftClickDrag) {
 17529  	switch vt := u.any.(type) {
 17530  	case *BetaBrowserToolsetConfigsParam:
 17531  		res.any = &vt.LeftClickDrag
 17532  	case *BetaComputerToolsetConfigsParam:
 17533  		res.any = &vt.LeftClickDrag
 17534  	}
 17535  	return res
 17536  }
 17537  
 17538  // Can have the runtime types [*BetaBrowserLeftClickDragConfigParam],
 17539  // [*BetaComputerLeftClickDragConfigParam]
 17540  type betaMessageCountTokensParamsToolUnionConfigsLeftClickDrag struct{ any }
 17541  
 17542  // Use the following switch statement to get the type of the union:
 17543  //
 17544  //	switch u.AsAny().(type) {
 17545  //	case *anthropic.BetaBrowserLeftClickDragConfigParam:
 17546  //	case *anthropic.BetaComputerLeftClickDragConfigParam:
 17547  //	default:
 17548  //	    fmt.Errorf("not present")
 17549  //	}
 17550  func (u betaMessageCountTokensParamsToolUnionConfigsLeftClickDrag) AsAny() any { return u.any }
 17551  
 17552  // Returns a pointer to the underlying variant's property, if present.
 17553  func (u betaMessageCountTokensParamsToolUnionConfigsLeftClickDrag) GetDeferLoading() *bool {
 17554  	switch vt := u.any.(type) {
 17555  	case *BetaBrowserLeftClickDragConfigParam:
 17556  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17557  	case *BetaComputerLeftClickDragConfigParam:
 17558  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17559  	}
 17560  	return nil
 17561  }
 17562  
 17563  // Returns a pointer to the underlying variant's property, if present.
 17564  func (u betaMessageCountTokensParamsToolUnionConfigsLeftClickDrag) GetEnabled() *bool {
 17565  	switch vt := u.any.(type) {
 17566  	case *BetaBrowserLeftClickDragConfigParam:
 17567  		return paramutil.AddrIfPresent(vt.Enabled)
 17568  	case *BetaComputerLeftClickDragConfigParam:
 17569  		return paramutil.AddrIfPresent(vt.Enabled)
 17570  	}
 17571  	return nil
 17572  }
 17573  
 17574  // Returns a subunion which exports methods to access subproperties
 17575  //
 17576  // Or use AsAny() to get the underlying value
 17577  func (u betaMessageCountTokensParamsToolUnionConfigs) GetLeftMouseDown() (res betaMessageCountTokensParamsToolUnionConfigsLeftMouseDown) {
 17578  	switch vt := u.any.(type) {
 17579  	case *BetaBrowserToolsetConfigsParam:
 17580  		res.any = &vt.LeftMouseDown
 17581  	case *BetaComputerToolsetConfigsParam:
 17582  		res.any = &vt.LeftMouseDown
 17583  	}
 17584  	return res
 17585  }
 17586  
 17587  // Can have the runtime types [*BetaBrowserLeftMouseDownConfigParam],
 17588  // [*BetaComputerLeftMouseDownConfigParam]
 17589  type betaMessageCountTokensParamsToolUnionConfigsLeftMouseDown struct{ any }
 17590  
 17591  // Use the following switch statement to get the type of the union:
 17592  //
 17593  //	switch u.AsAny().(type) {
 17594  //	case *anthropic.BetaBrowserLeftMouseDownConfigParam:
 17595  //	case *anthropic.BetaComputerLeftMouseDownConfigParam:
 17596  //	default:
 17597  //	    fmt.Errorf("not present")
 17598  //	}
 17599  func (u betaMessageCountTokensParamsToolUnionConfigsLeftMouseDown) AsAny() any { return u.any }
 17600  
 17601  // Returns a pointer to the underlying variant's property, if present.
 17602  func (u betaMessageCountTokensParamsToolUnionConfigsLeftMouseDown) GetDeferLoading() *bool {
 17603  	switch vt := u.any.(type) {
 17604  	case *BetaBrowserLeftMouseDownConfigParam:
 17605  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17606  	case *BetaComputerLeftMouseDownConfigParam:
 17607  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17608  	}
 17609  	return nil
 17610  }
 17611  
 17612  // Returns a pointer to the underlying variant's property, if present.
 17613  func (u betaMessageCountTokensParamsToolUnionConfigsLeftMouseDown) GetEnabled() *bool {
 17614  	switch vt := u.any.(type) {
 17615  	case *BetaBrowserLeftMouseDownConfigParam:
 17616  		return paramutil.AddrIfPresent(vt.Enabled)
 17617  	case *BetaComputerLeftMouseDownConfigParam:
 17618  		return paramutil.AddrIfPresent(vt.Enabled)
 17619  	}
 17620  	return nil
 17621  }
 17622  
 17623  // Returns a subunion which exports methods to access subproperties
 17624  //
 17625  // Or use AsAny() to get the underlying value
 17626  func (u betaMessageCountTokensParamsToolUnionConfigs) GetLeftMouseUp() (res betaMessageCountTokensParamsToolUnionConfigsLeftMouseUp) {
 17627  	switch vt := u.any.(type) {
 17628  	case *BetaBrowserToolsetConfigsParam:
 17629  		res.any = &vt.LeftMouseUp
 17630  	case *BetaComputerToolsetConfigsParam:
 17631  		res.any = &vt.LeftMouseUp
 17632  	}
 17633  	return res
 17634  }
 17635  
 17636  // Can have the runtime types [*BetaBrowserLeftMouseUpConfigParam],
 17637  // [*BetaComputerLeftMouseUpConfigParam]
 17638  type betaMessageCountTokensParamsToolUnionConfigsLeftMouseUp struct{ any }
 17639  
 17640  // Use the following switch statement to get the type of the union:
 17641  //
 17642  //	switch u.AsAny().(type) {
 17643  //	case *anthropic.BetaBrowserLeftMouseUpConfigParam:
 17644  //	case *anthropic.BetaComputerLeftMouseUpConfigParam:
 17645  //	default:
 17646  //	    fmt.Errorf("not present")
 17647  //	}
 17648  func (u betaMessageCountTokensParamsToolUnionConfigsLeftMouseUp) AsAny() any { return u.any }
 17649  
 17650  // Returns a pointer to the underlying variant's property, if present.
 17651  func (u betaMessageCountTokensParamsToolUnionConfigsLeftMouseUp) GetDeferLoading() *bool {
 17652  	switch vt := u.any.(type) {
 17653  	case *BetaBrowserLeftMouseUpConfigParam:
 17654  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17655  	case *BetaComputerLeftMouseUpConfigParam:
 17656  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17657  	}
 17658  	return nil
 17659  }
 17660  
 17661  // Returns a pointer to the underlying variant's property, if present.
 17662  func (u betaMessageCountTokensParamsToolUnionConfigsLeftMouseUp) GetEnabled() *bool {
 17663  	switch vt := u.any.(type) {
 17664  	case *BetaBrowserLeftMouseUpConfigParam:
 17665  		return paramutil.AddrIfPresent(vt.Enabled)
 17666  	case *BetaComputerLeftMouseUpConfigParam:
 17667  		return paramutil.AddrIfPresent(vt.Enabled)
 17668  	}
 17669  	return nil
 17670  }
 17671  
 17672  // Returns a subunion which exports methods to access subproperties
 17673  //
 17674  // Or use AsAny() to get the underlying value
 17675  func (u betaMessageCountTokensParamsToolUnionConfigs) GetMiddleClick() (res betaMessageCountTokensParamsToolUnionConfigsMiddleClick) {
 17676  	switch vt := u.any.(type) {
 17677  	case *BetaBrowserToolsetConfigsParam:
 17678  		res.any = &vt.MiddleClick
 17679  	case *BetaComputerToolsetConfigsParam:
 17680  		res.any = &vt.MiddleClick
 17681  	}
 17682  	return res
 17683  }
 17684  
 17685  // Can have the runtime types [*BetaBrowserMiddleClickConfigParam],
 17686  // [*BetaComputerMiddleClickConfigParam]
 17687  type betaMessageCountTokensParamsToolUnionConfigsMiddleClick struct{ any }
 17688  
 17689  // Use the following switch statement to get the type of the union:
 17690  //
 17691  //	switch u.AsAny().(type) {
 17692  //	case *anthropic.BetaBrowserMiddleClickConfigParam:
 17693  //	case *anthropic.BetaComputerMiddleClickConfigParam:
 17694  //	default:
 17695  //	    fmt.Errorf("not present")
 17696  //	}
 17697  func (u betaMessageCountTokensParamsToolUnionConfigsMiddleClick) AsAny() any { return u.any }
 17698  
 17699  // Returns a pointer to the underlying variant's property, if present.
 17700  func (u betaMessageCountTokensParamsToolUnionConfigsMiddleClick) GetDeferLoading() *bool {
 17701  	switch vt := u.any.(type) {
 17702  	case *BetaBrowserMiddleClickConfigParam:
 17703  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17704  	case *BetaComputerMiddleClickConfigParam:
 17705  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17706  	}
 17707  	return nil
 17708  }
 17709  
 17710  // Returns a pointer to the underlying variant's property, if present.
 17711  func (u betaMessageCountTokensParamsToolUnionConfigsMiddleClick) GetEnabled() *bool {
 17712  	switch vt := u.any.(type) {
 17713  	case *BetaBrowserMiddleClickConfigParam:
 17714  		return paramutil.AddrIfPresent(vt.Enabled)
 17715  	case *BetaComputerMiddleClickConfigParam:
 17716  		return paramutil.AddrIfPresent(vt.Enabled)
 17717  	}
 17718  	return nil
 17719  }
 17720  
 17721  // Returns a subunion which exports methods to access subproperties
 17722  //
 17723  // Or use AsAny() to get the underlying value
 17724  func (u betaMessageCountTokensParamsToolUnionConfigs) GetMouseMove() (res betaMessageCountTokensParamsToolUnionConfigsMouseMove) {
 17725  	switch vt := u.any.(type) {
 17726  	case *BetaBrowserToolsetConfigsParam:
 17727  		res.any = &vt.MouseMove
 17728  	case *BetaComputerToolsetConfigsParam:
 17729  		res.any = &vt.MouseMove
 17730  	}
 17731  	return res
 17732  }
 17733  
 17734  // Can have the runtime types [*BetaBrowserMouseMoveConfigParam],
 17735  // [*BetaComputerMouseMoveConfigParam]
 17736  type betaMessageCountTokensParamsToolUnionConfigsMouseMove struct{ any }
 17737  
 17738  // Use the following switch statement to get the type of the union:
 17739  //
 17740  //	switch u.AsAny().(type) {
 17741  //	case *anthropic.BetaBrowserMouseMoveConfigParam:
 17742  //	case *anthropic.BetaComputerMouseMoveConfigParam:
 17743  //	default:
 17744  //	    fmt.Errorf("not present")
 17745  //	}
 17746  func (u betaMessageCountTokensParamsToolUnionConfigsMouseMove) AsAny() any { return u.any }
 17747  
 17748  // Returns a pointer to the underlying variant's property, if present.
 17749  func (u betaMessageCountTokensParamsToolUnionConfigsMouseMove) GetDeferLoading() *bool {
 17750  	switch vt := u.any.(type) {
 17751  	case *BetaBrowserMouseMoveConfigParam:
 17752  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17753  	case *BetaComputerMouseMoveConfigParam:
 17754  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17755  	}
 17756  	return nil
 17757  }
 17758  
 17759  // Returns a pointer to the underlying variant's property, if present.
 17760  func (u betaMessageCountTokensParamsToolUnionConfigsMouseMove) GetEnabled() *bool {
 17761  	switch vt := u.any.(type) {
 17762  	case *BetaBrowserMouseMoveConfigParam:
 17763  		return paramutil.AddrIfPresent(vt.Enabled)
 17764  	case *BetaComputerMouseMoveConfigParam:
 17765  		return paramutil.AddrIfPresent(vt.Enabled)
 17766  	}
 17767  	return nil
 17768  }
 17769  
 17770  // Returns a subunion which exports methods to access subproperties
 17771  //
 17772  // Or use AsAny() to get the underlying value
 17773  func (u betaMessageCountTokensParamsToolUnionConfigs) GetRightClick() (res betaMessageCountTokensParamsToolUnionConfigsRightClick) {
 17774  	switch vt := u.any.(type) {
 17775  	case *BetaBrowserToolsetConfigsParam:
 17776  		res.any = &vt.RightClick
 17777  	case *BetaComputerToolsetConfigsParam:
 17778  		res.any = &vt.RightClick
 17779  	}
 17780  	return res
 17781  }
 17782  
 17783  // Can have the runtime types [*BetaBrowserRightClickConfigParam],
 17784  // [*BetaComputerRightClickConfigParam]
 17785  type betaMessageCountTokensParamsToolUnionConfigsRightClick struct{ any }
 17786  
 17787  // Use the following switch statement to get the type of the union:
 17788  //
 17789  //	switch u.AsAny().(type) {
 17790  //	case *anthropic.BetaBrowserRightClickConfigParam:
 17791  //	case *anthropic.BetaComputerRightClickConfigParam:
 17792  //	default:
 17793  //	    fmt.Errorf("not present")
 17794  //	}
 17795  func (u betaMessageCountTokensParamsToolUnionConfigsRightClick) AsAny() any { return u.any }
 17796  
 17797  // Returns a pointer to the underlying variant's property, if present.
 17798  func (u betaMessageCountTokensParamsToolUnionConfigsRightClick) GetDeferLoading() *bool {
 17799  	switch vt := u.any.(type) {
 17800  	case *BetaBrowserRightClickConfigParam:
 17801  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17802  	case *BetaComputerRightClickConfigParam:
 17803  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17804  	}
 17805  	return nil
 17806  }
 17807  
 17808  // Returns a pointer to the underlying variant's property, if present.
 17809  func (u betaMessageCountTokensParamsToolUnionConfigsRightClick) GetEnabled() *bool {
 17810  	switch vt := u.any.(type) {
 17811  	case *BetaBrowserRightClickConfigParam:
 17812  		return paramutil.AddrIfPresent(vt.Enabled)
 17813  	case *BetaComputerRightClickConfigParam:
 17814  		return paramutil.AddrIfPresent(vt.Enabled)
 17815  	}
 17816  	return nil
 17817  }
 17818  
 17819  // Returns a subunion which exports methods to access subproperties
 17820  //
 17821  // Or use AsAny() to get the underlying value
 17822  func (u betaMessageCountTokensParamsToolUnionConfigs) GetScreenshot() (res betaMessageCountTokensParamsToolUnionConfigsScreenshot) {
 17823  	switch vt := u.any.(type) {
 17824  	case *BetaBrowserToolsetConfigsParam:
 17825  		res.any = &vt.Screenshot
 17826  	case *BetaComputerToolsetConfigsParam:
 17827  		res.any = &vt.Screenshot
 17828  	}
 17829  	return res
 17830  }
 17831  
 17832  // Can have the runtime types [*BetaBrowserScreenshotConfigParam],
 17833  // [*BetaComputerScreenshotConfigParam]
 17834  type betaMessageCountTokensParamsToolUnionConfigsScreenshot struct{ any }
 17835  
 17836  // Use the following switch statement to get the type of the union:
 17837  //
 17838  //	switch u.AsAny().(type) {
 17839  //	case *anthropic.BetaBrowserScreenshotConfigParam:
 17840  //	case *anthropic.BetaComputerScreenshotConfigParam:
 17841  //	default:
 17842  //	    fmt.Errorf("not present")
 17843  //	}
 17844  func (u betaMessageCountTokensParamsToolUnionConfigsScreenshot) AsAny() any { return u.any }
 17845  
 17846  // Returns a pointer to the underlying variant's property, if present.
 17847  func (u betaMessageCountTokensParamsToolUnionConfigsScreenshot) GetDeferLoading() *bool {
 17848  	switch vt := u.any.(type) {
 17849  	case *BetaBrowserScreenshotConfigParam:
 17850  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17851  	case *BetaComputerScreenshotConfigParam:
 17852  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17853  	}
 17854  	return nil
 17855  }
 17856  
 17857  // Returns a pointer to the underlying variant's property, if present.
 17858  func (u betaMessageCountTokensParamsToolUnionConfigsScreenshot) GetEnabled() *bool {
 17859  	switch vt := u.any.(type) {
 17860  	case *BetaBrowserScreenshotConfigParam:
 17861  		return paramutil.AddrIfPresent(vt.Enabled)
 17862  	case *BetaComputerScreenshotConfigParam:
 17863  		return paramutil.AddrIfPresent(vt.Enabled)
 17864  	}
 17865  	return nil
 17866  }
 17867  
 17868  // Returns a subunion which exports methods to access subproperties
 17869  //
 17870  // Or use AsAny() to get the underlying value
 17871  func (u betaMessageCountTokensParamsToolUnionConfigs) GetScroll() (res betaMessageCountTokensParamsToolUnionConfigsScroll) {
 17872  	switch vt := u.any.(type) {
 17873  	case *BetaBrowserToolsetConfigsParam:
 17874  		res.any = &vt.Scroll
 17875  	case *BetaComputerToolsetConfigsParam:
 17876  		res.any = &vt.Scroll
 17877  	}
 17878  	return res
 17879  }
 17880  
 17881  // Can have the runtime types [*BetaBrowserScrollConfigParam],
 17882  // [*BetaComputerScrollConfigParam]
 17883  type betaMessageCountTokensParamsToolUnionConfigsScroll struct{ any }
 17884  
 17885  // Use the following switch statement to get the type of the union:
 17886  //
 17887  //	switch u.AsAny().(type) {
 17888  //	case *anthropic.BetaBrowserScrollConfigParam:
 17889  //	case *anthropic.BetaComputerScrollConfigParam:
 17890  //	default:
 17891  //	    fmt.Errorf("not present")
 17892  //	}
 17893  func (u betaMessageCountTokensParamsToolUnionConfigsScroll) AsAny() any { return u.any }
 17894  
 17895  // Returns a pointer to the underlying variant's property, if present.
 17896  func (u betaMessageCountTokensParamsToolUnionConfigsScroll) GetDeferLoading() *bool {
 17897  	switch vt := u.any.(type) {
 17898  	case *BetaBrowserScrollConfigParam:
 17899  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17900  	case *BetaComputerScrollConfigParam:
 17901  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17902  	}
 17903  	return nil
 17904  }
 17905  
 17906  // Returns a pointer to the underlying variant's property, if present.
 17907  func (u betaMessageCountTokensParamsToolUnionConfigsScroll) GetEnabled() *bool {
 17908  	switch vt := u.any.(type) {
 17909  	case *BetaBrowserScrollConfigParam:
 17910  		return paramutil.AddrIfPresent(vt.Enabled)
 17911  	case *BetaComputerScrollConfigParam:
 17912  		return paramutil.AddrIfPresent(vt.Enabled)
 17913  	}
 17914  	return nil
 17915  }
 17916  
 17917  // Returns a subunion which exports methods to access subproperties
 17918  //
 17919  // Or use AsAny() to get the underlying value
 17920  func (u betaMessageCountTokensParamsToolUnionConfigs) GetTripleClick() (res betaMessageCountTokensParamsToolUnionConfigsTripleClick) {
 17921  	switch vt := u.any.(type) {
 17922  	case *BetaBrowserToolsetConfigsParam:
 17923  		res.any = &vt.TripleClick
 17924  	case *BetaComputerToolsetConfigsParam:
 17925  		res.any = &vt.TripleClick
 17926  	}
 17927  	return res
 17928  }
 17929  
 17930  // Can have the runtime types [*BetaBrowserTripleClickConfigParam],
 17931  // [*BetaComputerTripleClickConfigParam]
 17932  type betaMessageCountTokensParamsToolUnionConfigsTripleClick struct{ any }
 17933  
 17934  // Use the following switch statement to get the type of the union:
 17935  //
 17936  //	switch u.AsAny().(type) {
 17937  //	case *anthropic.BetaBrowserTripleClickConfigParam:
 17938  //	case *anthropic.BetaComputerTripleClickConfigParam:
 17939  //	default:
 17940  //	    fmt.Errorf("not present")
 17941  //	}
 17942  func (u betaMessageCountTokensParamsToolUnionConfigsTripleClick) AsAny() any { return u.any }
 17943  
 17944  // Returns a pointer to the underlying variant's property, if present.
 17945  func (u betaMessageCountTokensParamsToolUnionConfigsTripleClick) GetDeferLoading() *bool {
 17946  	switch vt := u.any.(type) {
 17947  	case *BetaBrowserTripleClickConfigParam:
 17948  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17949  	case *BetaComputerTripleClickConfigParam:
 17950  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17951  	}
 17952  	return nil
 17953  }
 17954  
 17955  // Returns a pointer to the underlying variant's property, if present.
 17956  func (u betaMessageCountTokensParamsToolUnionConfigsTripleClick) GetEnabled() *bool {
 17957  	switch vt := u.any.(type) {
 17958  	case *BetaBrowserTripleClickConfigParam:
 17959  		return paramutil.AddrIfPresent(vt.Enabled)
 17960  	case *BetaComputerTripleClickConfigParam:
 17961  		return paramutil.AddrIfPresent(vt.Enabled)
 17962  	}
 17963  	return nil
 17964  }
 17965  
 17966  // Returns a subunion which exports methods to access subproperties
 17967  //
 17968  // Or use AsAny() to get the underlying value
 17969  func (u betaMessageCountTokensParamsToolUnionConfigs) GetType() (res betaMessageCountTokensParamsToolUnionConfigsType) {
 17970  	switch vt := u.any.(type) {
 17971  	case *BetaBrowserToolsetConfigsParam:
 17972  		res.any = &vt.Type
 17973  	case *BetaComputerToolsetConfigsParam:
 17974  		res.any = &vt.Type
 17975  	}
 17976  	return res
 17977  }
 17978  
 17979  // Can have the runtime types [*BetaBrowserTypeConfigParam],
 17980  // [*BetaComputerTypeConfigParam]
 17981  type betaMessageCountTokensParamsToolUnionConfigsType struct{ any }
 17982  
 17983  // Use the following switch statement to get the type of the union:
 17984  //
 17985  //	switch u.AsAny().(type) {
 17986  //	case *anthropic.BetaBrowserTypeConfigParam:
 17987  //	case *anthropic.BetaComputerTypeConfigParam:
 17988  //	default:
 17989  //	    fmt.Errorf("not present")
 17990  //	}
 17991  func (u betaMessageCountTokensParamsToolUnionConfigsType) AsAny() any { return u.any }
 17992  
 17993  // Returns a pointer to the underlying variant's property, if present.
 17994  func (u betaMessageCountTokensParamsToolUnionConfigsType) GetDeferLoading() *bool {
 17995  	switch vt := u.any.(type) {
 17996  	case *BetaBrowserTypeConfigParam:
 17997  		return paramutil.AddrIfPresent(vt.DeferLoading)
 17998  	case *BetaComputerTypeConfigParam:
 17999  		return paramutil.AddrIfPresent(vt.DeferLoading)
 18000  	}
 18001  	return nil
 18002  }
 18003  
 18004  // Returns a pointer to the underlying variant's property, if present.
 18005  func (u betaMessageCountTokensParamsToolUnionConfigsType) GetEnabled() *bool {
 18006  	switch vt := u.any.(type) {
 18007  	case *BetaBrowserTypeConfigParam:
 18008  		return paramutil.AddrIfPresent(vt.Enabled)
 18009  	case *BetaComputerTypeConfigParam:
 18010  		return paramutil.AddrIfPresent(vt.Enabled)
 18011  	}
 18012  	return nil
 18013  }
 18014  
 18015  // Returns a subunion which exports methods to access subproperties
 18016  //
 18017  // Or use AsAny() to get the underlying value
 18018  func (u betaMessageCountTokensParamsToolUnionConfigs) GetWait() (res betaMessageCountTokensParamsToolUnionConfigsWait) {
 18019  	switch vt := u.any.(type) {
 18020  	case *BetaBrowserToolsetConfigsParam:
 18021  		res.any = &vt.Wait
 18022  	case *BetaComputerToolsetConfigsParam:
 18023  		res.any = &vt.Wait
 18024  	}
 18025  	return res
 18026  }
 18027  
 18028  // Can have the runtime types [*BetaBrowserWaitConfigParam],
 18029  // [*BetaComputerWaitConfigParam]
 18030  type betaMessageCountTokensParamsToolUnionConfigsWait struct{ any }
 18031  
 18032  // Use the following switch statement to get the type of the union:
 18033  //
 18034  //	switch u.AsAny().(type) {
 18035  //	case *anthropic.BetaBrowserWaitConfigParam:
 18036  //	case *anthropic.BetaComputerWaitConfigParam:
 18037  //	default:
 18038  //	    fmt.Errorf("not present")
 18039  //	}
 18040  func (u betaMessageCountTokensParamsToolUnionConfigsWait) AsAny() any { return u.any }
 18041  
 18042  // Returns a pointer to the underlying variant's property, if present.
 18043  func (u betaMessageCountTokensParamsToolUnionConfigsWait) GetDeferLoading() *bool {
 18044  	switch vt := u.any.(type) {
 18045  	case *BetaBrowserWaitConfigParam:
 18046  		return paramutil.AddrIfPresent(vt.DeferLoading)
 18047  	case *BetaComputerWaitConfigParam:
 18048  		return paramutil.AddrIfPresent(vt.DeferLoading)
 18049  	}
 18050  	return nil
 18051  }
 18052  
 18053  // Returns a pointer to the underlying variant's property, if present.
 18054  func (u betaMessageCountTokensParamsToolUnionConfigsWait) GetEnabled() *bool {
 18055  	switch vt := u.any.(type) {
 18056  	case *BetaBrowserWaitConfigParam:
 18057  		return paramutil.AddrIfPresent(vt.Enabled)
 18058  	case *BetaComputerWaitConfigParam:
 18059  		return paramutil.AddrIfPresent(vt.Enabled)
 18060  	}
 18061  	return nil
 18062  }
 18063  
 18064  // Returns a subunion which exports methods to access subproperties
 18065  //
 18066  // Or use AsAny() to get the underlying value
 18067  func (u betaMessageCountTokensParamsToolUnionConfigs) GetZoom() (res betaMessageCountTokensParamsToolUnionConfigsZoom) {
 18068  	switch vt := u.any.(type) {
 18069  	case *BetaBrowserToolsetConfigsParam:
 18070  		res.any = &vt.Zoom
 18071  	case *BetaComputerToolsetConfigsParam:
 18072  		res.any = &vt.Zoom
 18073  	}
 18074  	return res
 18075  }
 18076  
 18077  // Can have the runtime types [*BetaBrowserZoomConfigParam],
 18078  // [*BetaComputerZoomConfigParam]
 18079  type betaMessageCountTokensParamsToolUnionConfigsZoom struct{ any }
 18080  
 18081  // Use the following switch statement to get the type of the union:
 18082  //
 18083  //	switch u.AsAny().(type) {
 18084  //	case *anthropic.BetaBrowserZoomConfigParam:
 18085  //	case *anthropic.BetaComputerZoomConfigParam:
 18086  //	default:
 18087  //	    fmt.Errorf("not present")
 18088  //	}
 18089  func (u betaMessageCountTokensParamsToolUnionConfigsZoom) AsAny() any { return u.any }
 18090  
 18091  // Returns a pointer to the underlying variant's property, if present.
 18092  func (u betaMessageCountTokensParamsToolUnionConfigsZoom) GetDeferLoading() *bool {
 18093  	switch vt := u.any.(type) {
 18094  	case *BetaBrowserZoomConfigParam:
 18095  		return paramutil.AddrIfPresent(vt.DeferLoading)
 18096  	case *BetaComputerZoomConfigParam:
 18097  		return paramutil.AddrIfPresent(vt.DeferLoading)
 18098  	}
 18099  	return nil
 18100  }
 18101  
 18102  // Returns a pointer to the underlying variant's property, if present.
 18103  func (u betaMessageCountTokensParamsToolUnionConfigsZoom) GetEnabled() *bool {
 18104  	switch vt := u.any.(type) {
 18105  	case *BetaBrowserZoomConfigParam:
 18106  		return paramutil.AddrIfPresent(vt.Enabled)
 18107  	case *BetaComputerZoomConfigParam:
 18108  		return paramutil.AddrIfPresent(vt.Enabled)
 18109  	}
 18110  	return nil
 18111  }
 18112  
 18113  // Returns a pointer to the underlying variant's AllowedDomains property, if
 18114  // present.
 18115  func (u BetaMessageCountTokensParamsToolUnion) GetAllowedDomains() []string {
 18116  	if vt := u.OfWebSearchTool20250305; vt != nil {
 18117  		return vt.AllowedDomains
 18118  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 18119  		return vt.AllowedDomains
 18120  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 18121  		return vt.AllowedDomains
 18122  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 18123  		return vt.AllowedDomains
 18124  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 18125  		return vt.AllowedDomains
 18126  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 18127  		return vt.AllowedDomains
 18128  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 18129  		return vt.AllowedDomains
 18130  	}
 18131  	return nil
 18132  }
 18133  
 18134  // Returns a pointer to the underlying variant's BlockedDomains property, if
 18135  // present.
 18136  func (u BetaMessageCountTokensParamsToolUnion) GetBlockedDomains() []string {
 18137  	if vt := u.OfWebSearchTool20250305; vt != nil {
 18138  		return vt.BlockedDomains
 18139  	} else if vt := u.OfWebFetchTool20250910; vt != nil {
 18140  		return vt.BlockedDomains
 18141  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 18142  		return vt.BlockedDomains
 18143  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 18144  		return vt.BlockedDomains
 18145  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 18146  		return vt.BlockedDomains
 18147  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 18148  		return vt.BlockedDomains
 18149  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 18150  		return vt.BlockedDomains
 18151  	}
 18152  	return nil
 18153  }
 18154  
 18155  // Returns a pointer to the underlying variant's UserLocation property, if present.
 18156  func (u BetaMessageCountTokensParamsToolUnion) GetUserLocation() *BetaUserLocationParam {
 18157  	if vt := u.OfWebSearchTool20250305; vt != nil {
 18158  		return &vt.UserLocation
 18159  	} else if vt := u.OfWebSearchTool20260209; vt != nil {
 18160  		return &vt.UserLocation
 18161  	} else if vt := u.OfWebSearchTool20260318; vt != nil {
 18162  		return &vt.UserLocation
 18163  	}
 18164  	return nil
 18165  }
 18166  
 18167  // Returns a pointer to the underlying variant's Citations property, if present.
 18168  func (u BetaMessageCountTokensParamsToolUnion) GetCitations() *BetaCitationsConfigParam {
 18169  	if vt := u.OfWebFetchTool20250910; vt != nil {
 18170  		return &vt.Citations
 18171  	} else if vt := u.OfWebFetchTool20260209; vt != nil {
 18172  		return &vt.Citations
 18173  	} else if vt := u.OfWebFetchTool20260309; vt != nil {
 18174  		return &vt.Citations
 18175  	} else if vt := u.OfWebFetchTool20260318; vt != nil {
 18176  		return &vt.Citations
 18177  	}
 18178  	return nil
 18179  }