Class: Anthropic::Models::Beta::Messages::BatchCreateParams::Request

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/beta/messages/batch_create_params.rb,
sig/anthropic/models/beta/messages/batch_create_params.rbs

Defined Under Namespace

Classes: Params

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(custom_id:, params:) ⇒ Request

Some parameter documentations has been truncated, see Anthropic::Models::Beta::Messages::BatchCreateParams::Request for more details.

Parameters:



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 60

class Request < Anthropic::Internal::Type::BaseModel
  # @!attribute custom_id
  #   Developer-provided ID created for each request in a Message Batch. Useful for
  #   matching results to requests, as results may be given out of request order.
  #
  #   Must be unique for each request within the Message Batch.
  #
  #   @return [String]
  required :custom_id, String

  # @!attribute params
  #   Messages API creation parameters for the individual request.
  #
  #   See the
  #   [Messages API reference](https://platform.claude.com/docs/en/api/messages) for
  #   full documentation on available parameters.
  #
  #   @return [Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params]
  required :params, -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params }

  # @!method initialize(custom_id:, params:)
  #   Some parameter documentations has been truncated, see
  #   {Anthropic::Models::Beta::Messages::BatchCreateParams::Request} for more
  #   details.
  #
  #   @param custom_id [String] Developer-provided ID created for each request in a Message Batch. Useful for ma
  #
  #   @param params [Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params] Messages API creation parameters for the individual request.

  # @see Anthropic::Models::Beta::Messages::BatchCreateParams::Request#params
  class Params < Anthropic::Internal::Type::BaseModel
    # @!attribute max_tokens
    #   The maximum number of tokens to generate before stopping.
    #
    #   Note that our models may stop _before_ reaching this maximum. This parameter
    #   only specifies the absolute maximum number of tokens to generate.
    #
    #   Set to `0` to populate the
    #   [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache)
    #   without generating a response.
    #
    #   Different models have different maximum values for this parameter. See
    #   [models](https://platform.claude.com/docs/en/about-claude/models/overview) for
    #   details.
    #
    #   @return [Integer]
    required :max_tokens, Integer

    # @!attribute messages
    #   Input messages.
    #
    #   Our models are trained to operate on alternating `user` and `assistant`
    #   conversational turns. When creating a new `Message`, you specify the prior
    #   conversational turns with the `messages` parameter, and the model then generates
    #   the next `Message` in the conversation. Consecutive `user` or `assistant` turns
    #   in your request will be combined into a single turn.
    #
    #   Each input message must be an object with a `role` and `content`. You can
    #   specify a single `user`-role message, or you can include multiple `user` and
    #   `assistant` messages.
    #
    #   If the final message uses the `assistant` role, the response content will
    #   continue immediately from the content in that message. This can be used to
    #   constrain part of the model's response. This is called prefill. On models that
    #   don't support prefill, creating a message that ends with a partial `assistant`
    #   response returns a 400 error. See
    #   [Prefill not supported](https://platform.claude.com/docs/en/api/errors#prefill-not-supported).
    #
    #   Example with a single `user` message:
    #
    #   ```json
    #   [{ "role": "user", "content": "Hello, Claude" }]
    #   ```
    #
    #   Example with multiple conversational turns:
    #
    #   ```json
    #   [
    #     { "role": "user", "content": "Hello there." },
    #     { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
    #     { "role": "user", "content": "Can you explain LLMs in plain English?" }
    #   ]
    #   ```
    #
    #   Example with a partially-filled response from Claude, for models that support
    #   prefill:
    #
    #   ```json
    #   [
    #     {
    #       "role": "user",
    #       "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
    #     },
    #     { "role": "assistant", "content": "The best answer is (" }
    #   ]
    #   ```
    #
    #   Each input message `content` may be either a single `string` or an array of
    #   content blocks, where each block has a specific `type`. Using a `string` for
    #   `content` is shorthand for an array of one content block of type `"text"`. The
    #   following input messages are equivalent:
    #
    #   ```json
    #   { "role": "user", "content": "Hello, Claude" }
    #   ```
    #
    #   ```json
    #   { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
    #   ```
    #
    #   See
    #   [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
    #
    #   Note that if you want to include a
    #   [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
    #   you can use the top-level `system` parameter.
    #
    #   There is a limit of 100,000 messages in a single request.
    #
    #   @return [Array<Anthropic::Models::Beta::BetaUserMessageParam, Anthropic::Models::Beta::BetaAssistantMessageParam, Anthropic::Models::Beta::BetaSystemMessageParam>]
    required :messages, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaMessageParam] }

    # @!attribute model
    #   The model that will complete your prompt.
    #
    #   See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
    #   details and options.
    #
    #   @return [Symbol, String, Anthropic::Models::Model]
    required :model, union: -> { Anthropic::Model }

    # @!attribute billing_policy
    #   Declares which organization is billed for this request.
    #   `{"type": "billing_policy", "bill_to": "user_profile"}` bills the customer
    #   behind the user profile named in the `anthropic-user-profile-id` header, instead
    #   of your organization. If that customer has not linked an Anthropic organization
    #   to the profile, or has not allowed your organization to bill it, the request is
    #   rejected rather than billed to you. Omit the field, or send `"bill_to": "self"`
    #   (the default), to be billed as usual.
    #
    #   Message Batches does not currently support billing the customer behind a user
    #   profile. In a batch, omit the field or send `"bill_to": "self"`. A request in a
    #   batch that sets `"bill_to": "user_profile"` gets an `errored` result with an
    #   `invalid_request_error`, nobody is billed for it, and the batch's other requests
    #   run as usual.
    #
    #   @return [Anthropic::Models::Beta::BetaBillingPolicy, nil]
    optional :billing_policy, -> { Anthropic::Beta::BetaBillingPolicy }, nil?: true

    # @!attribute cache_control
    #   Top-level cache control automatically applies a cache_control marker to the last
    #   cacheable block in the request.
    #
    #   @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
    optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true

    # @!attribute compaction
    #   Compaction configuration.
    #
    #   When set on `POST /v1/messages`, the request is a compaction request: the
    #   conversation in `messages` is summarized and the response holds only the
    #   resulting `compaction` block (`stop_reason` `"compaction"`), which later
    #   requests send first in `messages` in place of the messages it summarizes.
    #   `POST /v1/messages/count_tokens` accepts this parameter and ignores it: the
    #   count it returns is for the conversation in `messages` as sent. Cannot be
    #   combined with `context_management`.
    #
    #   @return [Anthropic::Models::Beta::BetaCompactionConfig, nil]
    optional :compaction, -> { Anthropic::Beta::BetaCompactionConfig }, nil?: true

    # @!attribute container
    #   Container identifier for reuse across requests.
    #
    #   @return [Anthropic::Models::Beta::BetaContainerParams, String, nil]
    optional :container,
             union: -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params::Container },
             nil?: true

    # @!attribute context_management
    #   Context management configuration.
    #
    #   This allows you to control how Claude manages context across multiple requests,
    #   such as whether to clear function results or not.
    #
    #   @return [Anthropic::Models::Beta::BetaContextManagementConfig, nil]
    optional :context_management, -> { Anthropic::Beta::BetaContextManagementConfig }, nil?: true

    # @!attribute diagnostics
    #   Request-level diagnostics. Supply `previous_message_id` to have the response
    #   include `diagnostics.cache_miss_reason` explaining any prompt-cache divergence
    #   from that prior request.
    #
    #   @return [Anthropic::Models::Beta::BetaDiagnosticsParam, nil]
    optional :diagnostics, -> { Anthropic::Beta::BetaDiagnosticsParam }, nil?: true

    # @!attribute fallback_credit_token
    #   The `fallback_credit_token` from a prior refusal's `stop_details`.
    #
    #   When a preceding request was refused and returned a `fallback_credit_token`,
    #   pass that code here on the retry to have the retry's cache-creation tokens for
    #   the prefix that was warm on the refused model billed at the cache-read rate.
    #   Must be redeemed by the same organization and workspace, with the same request
    #   body (optionally extended by one appended `assistant` message whose content is
    #   the partial text — with any trailing whitespace stripped from the final text
    #   block — and paired server-tool blocks streamed before the refusal; the
    #   appended-assistant form is not available for requests with `output_format` set
    #   or forced `tool_choice`), on an eligible fallback model, on the same platform,
    #   and within 5 minutes of the refusal; a mismatch is a 400. A token minted
    #   mid-server-tool-loop whose partial content was continuable may only be redeemed
    #   with the appended-assistant form — if an exact-body retry is rejected with a 400
    #   saying the token must be redeemed by continuing the partial response, retry with
    #   the appended-assistant form instead.
    #
    #   When the appended-assistant form is used on a model that otherwise disallows
    #   assistant-turn prefill, this token also authorizes that one prefill.
    #
    #   @return [Anthropic::Models::Beta::BetaFallbackCreditTokenParam, String, nil]
    optional :fallback_credit_token,
             union: -> {
               Anthropic::Beta::Messages::BatchCreateParams::Request::Params::FallbackCreditToken
             },
             nil?: true

    # @!attribute fallbacks
    #   Opt-in server-side retry on one or more substitute models when the requested
    #   model declines for policy reasons. Tried in order: if the first entry also
    #   declines, the second is tried, and so on. Some models don't support fallbacks;
    #   on those models, a list of fallback models returns a 400 error. See
    #   [Server-side fallback](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#server-side-fallback).
    #   The string "default" requests the requested model's server-defined default
    #   fallback configuration. On a model that doesn't support fallbacks, the request
    #   runs on the requested model alone, so a declined request stays declined.
    #
    #   @return [Symbol, :default, Array<Anthropic::Models::Beta::BetaFallbackParam>, nil]
    optional :fallbacks, union: -> { Anthropic::Beta::BetaFallbacksParam }, nil?: true

    # @!attribute inference_geo
    #   Specifies the geographic region for inference processing. If not specified, the
    #   workspace's `default_inference_geo` is used.
    #
    #   @return [String, nil]
    optional :inference_geo, String, nil?: true

    # @!attribute mcp_servers
    #   MCP servers to be utilized in this request
    #
    #   @return [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>, nil]
    optional :mcp_servers,
             -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaRequestMCPServerURLDefinition] }

    # @!attribute metadata
    #   An object describing metadata about the request.
    #
    #   @return [Anthropic::Models::Beta::BetaMetadata, nil]
    optional :metadata, -> { Anthropic::Beta::BetaMetadata }

    # @!attribute output_config
    #   Configuration options for the model's output, such as the output format.
    #
    #   @return [Anthropic::Models::Beta::BetaOutputConfig, nil]
    optional :output_config, -> { Anthropic::Beta::BetaOutputConfig }

    # @!attribute output_format
    #   @deprecated
    #
    #   Deprecated: Use `output_config.format` instead. See
    #   [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
    #
    #   A schema to specify Claude's output format in responses. This parameter will be
    #   removed in a future release.
    #
    #   @return [Anthropic::Models::Beta::BetaJSONOutputFormat, nil]
    optional :output_format, -> { Anthropic::Beta::BetaJSONOutputFormat }, nil?: true

    # @!attribute service_tier
    #   Determines whether to use priority capacity (if available) or standard capacity
    #   for this request.
    #
    #   Anthropic offers different levels of service for your API requests. See
    #   [service-tiers](https://platform.claude.com/docs/en/api/service-tiers) for
    #   details.
    #
    #   @return [Symbol, Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::ServiceTier, nil]
    optional :service_tier,
             enum: -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params::ServiceTier }

    # @!attribute speed
    #   The inference speed mode for this request. `"fast"` enables high
    #   output-tokens-per-second inference.
    #
    #   Some models require the `fast-mode-2026-02-01` beta header for any `speed`
    #   value. See
    #   [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) for
    #   which models.
    #
    #   @return [Symbol, Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::Speed, nil]
    optional :speed,
             enum: -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params::Speed },
             nil?: true

    # @!attribute stop_sequences
    #   Custom text sequences that will cause the model to stop generating.
    #
    #   Our models will normally stop when they have naturally completed their turn,
    #   which will result in a response `stop_reason` of `"end_turn"`.
    #
    #   If you want the model to stop generating when it encounters custom strings of
    #   text, you can use the `stop_sequences` parameter. If the model encounters one of
    #   the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
    #   and the response `stop_sequence` value will contain the matched stop sequence.
    #
    #   @return [Array<String>, nil]
    optional :stop_sequences, Anthropic::Internal::Type::ArrayOf[String]

    # @!attribute stream
    #   Whether to incrementally stream the response using server-sent events. When
    #   `true`, SDKs return a raw event stream.
    #
    #   In the TypeScript, Python and Ruby SDKs, the recommended way to stream is
    #   `messages.stream()`. It sets `stream` for you and accumulates the events into
    #   the final message. See
    #   [Streaming with SDKs](https://platform.claude.com/docs/en/build-with-claude/streaming#streaming-with-sdks)
    #   for an example in each language.
    #
    #   @return [Boolean, nil]
    optional :stream, Anthropic::Internal::Type::Boolean

    # @!attribute system_
    #   System prompt.
    #
    #   A system prompt is a way of providing context and instructions to Claude, such
    #   as specifying a particular goal or role. See our
    #   [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
    #
    #   @return [String, Array<Anthropic::Models::Beta::BetaTextBlockParam>, nil]
    optional :system_,
             union: -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params::System },
             api_name: :system

    # @!attribute thinking
    #   Configuration for Claude's thinking.
    #
    #   With `{"type": "adaptive"}`, Claude decides when and how much to think. With
    #   `{"type": "enabled"}` (manual extended thinking), you set a `budget_tokens` of
    #   at least 1,024. Thinking tokens count toward your `max_tokens` limit.
    #
    #   Which `type` values are accepted, and what happens when you omit `thinking`,
    #   depend on the model. See
    #   [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#configuring-thinking)
    #   for each model's behavior.
    #
    #   @return [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled, Anthropic::Models::Beta::BetaThinkingConfigBetweenTools, Anthropic::Models::Beta::BetaThinkingConfigAdaptive, nil]
    optional :thinking, union: -> { Anthropic::Beta::BetaThinkingConfigParam }

    # @!attribute thread
    #   Server-held conversation state (a Thread). `{"type": "create"}` asks the server
    #   to hold this conversation's state under the response's `id`;
    #   `{"type": "continue", "previous_message_id": ...}` resumes from a previous
    #   response so only the new turn's messages are sent. The response shape is
    #   unchanged.
    #
    #   @return [Anthropic::Models::Beta::BetaThreadCreateParams, Anthropic::Models::Beta::BetaThreadContinueParams, nil]
    optional :thread, union: -> { Anthropic::Beta::BetaMessageThreadParam }, nil?: true

    # @!attribute tool_choice
    #   How the model should use the provided tools. The model can use a specific tool,
    #   any available tool, decide by itself, or not use tools at all.
    #
    #   @return [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone, nil]
    optional :tool_choice, union: -> { Anthropic::Beta::BetaToolChoice }

    # @!attribute tools
    #   Definitions of tools that the model may use.
    #
    #   If you include `tools` in your API request, the model may return `tool_use`
    #   content blocks that represent the model's use of those tools. You can then run
    #   those tools using the tool input generated by the model and then optionally
    #   return results back to the model using `tool_result` content blocks.
    #
    #   There are two types of tools: **client tools** and **server tools**. The
    #   behavior described below applies to client tools. For
    #   [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
    #   see their individual documentation as each has its own behavior (e.g., the
    #   [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
    #
    #   Each tool definition includes:
    #
    #   - `name`: Name of the tool.
    #   - `description`: Optional, but strongly-recommended description of the tool.
    #   - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
    #     tool `input` shape that the model will produce in `tool_use` output content
    #     blocks.
    #
    #   For example, if you defined `tools` as:
    #
    #   ```json
    #   [
    #     {
    #       "name": "get_stock_price",
    #       "description": "Get the current stock price for a given ticker symbol.",
    #       "input_schema": {
    #         "type": "object",
    #         "properties": {
    #           "ticker": {
    #             "type": "string",
    #             "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
    #           }
    #         },
    #         "required": ["ticker"]
    #       }
    #     }
    #   ]
    #   ```
    #
    #   And then asked the model "What's the S&P 500 at today?", the model might produce
    #   `tool_use` content blocks in the response like this:
    #
    #   ```json
    #   [
    #     {
    #       "type": "tool_use",
    #       "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
    #       "name": "get_stock_price",
    #       "input": { "ticker": "^GSPC" }
    #     }
    #   ]
    #   ```
    #
    #   You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
    #   input, and return the following back to the model in a subsequent `user`
    #   message:
    #
    #   ```json
    #   [
    #     {
    #       "type": "tool_result",
    #       "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
    #       "content": "259.75 USD"
    #     }
    #   ]
    #   ```
    #
    #   Tools can be used for workflows that include running client-side tools and
    #   functions, or more generally whenever you want the model to produce a particular
    #   JSON structure of output.
    #
    #   See our
    #   [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
    #   for more details.
    #
    #   @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaCodeExecutionTool20260120, Anthropic::Models::Beta::BetaCodeExecutionTool20260521, Anthropic::Models::Beta::BetaBrowserToolset20260801, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20251124, Anthropic::Models::Beta::BetaComputerToolset20260801, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910, Anthropic::Models::Beta::BetaWebSearchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260309, Anthropic::Models::Beta::BetaWebSearchTool20260318, Anthropic::Models::Beta::BetaWebFetchTool20260318, Anthropic::Models::Beta::BetaAdvisorTool20260301, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119, Anthropic::Models::Beta::BetaMCPToolset>, nil]
    optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaToolUnion] }

    # @!method initialize(max_tokens:, messages:, model:, billing_policy: nil, cache_control: nil, compaction: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, stream: nil, system_: nil, thinking: nil, thread: nil, tool_choice: nil, tools: nil)
    #   Messages API creation parameters for the individual request.
    #
    #   See the
    #   [Messages API reference](https://platform.claude.com/docs/en/api/messages) for
    #   full documentation on available parameters.
    #
    #   Some parameter documentations has been truncated, see
    #   {Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params} for more
    #   details.
    #
    #   @param max_tokens [Integer] The maximum number of tokens to generate before stopping.
    #
    #   @param messages [Array<Anthropic::Models::Beta::BetaUserMessageParam, Anthropic::Models::Beta::BetaAssistantMessageParam, Anthropic::Models::Beta::BetaSystemMessageParam>] Input messages.
    #
    #   @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.
    #
    #   @param billing_policy [Anthropic::Models::Beta::BetaBillingPolicy, nil] Declares which organization is billed for this request.
    #
    #   @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Top-level cache control automatically applies a cache_control marker to the last
    #
    #   @param compaction [Anthropic::Models::Beta::BetaCompactionConfig, nil] Compaction configuration.
    #
    #   @param container [Anthropic::Models::Beta::BetaContainerParams, String, nil] Container identifier for reuse across requests.
    #
    #   @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Context management configuration.
    #
    #   @param diagnostics [Anthropic::Models::Beta::BetaDiagnosticsParam, nil] Request-level diagnostics. Supply `previous_message_id` to have the response inc
    #
    #   @param fallback_credit_token [Anthropic::Models::Beta::BetaFallbackCreditTokenParam, String, nil] The `fallback_credit_token` from a prior refusal's `stop_details`.
    #
    #   @param fallbacks [Symbol, :default, Array<Anthropic::Models::Beta::BetaFallbackParam>, nil] Opt-in server-side retry on one or more substitute models when the requested mod
    #
    #   @param inference_geo [String, nil] Specifies the geographic region for inference processing. If not specified, the
    #
    #   @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] MCP servers to be utilized in this request
    #
    #   @param metadata [Anthropic::Models::Beta::BetaMetadata] An object describing metadata about the request.
    #
    #   @param output_config [Anthropic::Models::Beta::BetaOutputConfig] Configuration options for the model's output, such as the output format.
    #
    #   @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Deprecated: Use `output_config.format` instead. See [structured outputs](https:/
    #
    #   @param service_tier [Symbol, Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::ServiceTier] Determines whether to use priority capacity (if available) or standard capacity
    #
    #   @param speed [Symbol, Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::Speed, nil] The inference speed mode for this request. `"fast"` enables high output-tokens-p
    #
    #   @param stop_sequences [Array<String>] Custom text sequences that will cause the model to stop generating.
    #
    #   @param stream [Boolean] Whether to incrementally stream the response using server-sent events. When
    #
    #   @param system_ [String, Array<Anthropic::Models::Beta::BetaTextBlockParam>] System prompt.
    #
    #   @param thinking [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled, Anthropic::Models::Beta::BetaThinkingConfigBetweenTools, Anthropic::Models::Beta::BetaThinkingConfigAdaptive] Configuration for Claude's thinking.
    #
    #   @param thread [Anthropic::Models::Beta::BetaThreadCreateParams, Anthropic::Models::Beta::BetaThreadContinueParams, nil] Server-held conversation state (a Thread). `{"type": "create"}` asks the server
    #
    #   @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
    #
    #   @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaCodeExecutionTool20260120, Anthropic::Models::Beta::BetaCodeExecutionTool20260521, Anthropic::Models::Beta::BetaBrowserToolset20260801, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20251124, Anthropic::Models::Beta::BetaComputerToolset20260801, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910, Anthropic::Models::Beta::BetaWebSearchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260309, Anthropic::Models::Beta::BetaWebSearchTool20260318, Anthropic::Models::Beta::BetaWebFetchTool20260318, Anthropic::Models::Beta::BetaAdvisorTool20260301, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119, Anthropic::Models::Beta::BetaMCPToolset>] Definitions of tools that the model may use.

    # Container identifier for reuse across requests.
    #
    # @see Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params#container
    module Container
      extend Anthropic::Internal::Type::Union

      # Container parameters with skills to be loaded.
      variant -> { Anthropic::Beta::BetaContainerParams }

      variant String

      # @!method self.variants
      #   @return [Array(Anthropic::Models::Beta::BetaContainerParams, String)]
    end

    # The `fallback_credit_token` from a prior refusal's `stop_details`.
    #
    # When a preceding request was refused and returned a `fallback_credit_token`,
    # pass that code here on the retry to have the retry's cache-creation tokens for
    # the prefix that was warm on the refused model billed at the cache-read rate.
    # Must be redeemed by the same organization and workspace, with the same request
    # body (optionally extended by one appended `assistant` message whose content is
    # the partial text — with any trailing whitespace stripped from the final text
    # block — and paired server-tool blocks streamed before the refusal; the
    # appended-assistant form is not available for requests with `output_format` set
    # or forced `tool_choice`), on an eligible fallback model, on the same platform,
    # and within 5 minutes of the refusal; a mismatch is a 400. A token minted
    # mid-server-tool-loop whose partial content was continuable may only be redeemed
    # with the appended-assistant form — if an exact-body retry is rejected with a 400
    # saying the token must be redeemed by continuing the partial response, retry with
    # the appended-assistant form instead.
    #
    # When the appended-assistant form is used on a model that otherwise disallows
    # assistant-turn prefill, this token also authorizes that one prefill.
    #
    # @see Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params#fallback_credit_token
    module FallbackCreditToken
      extend Anthropic::Internal::Type::Union

      # Object form of ``fallback_credit_token``: the token plus a redemption
      # mode.
      #
      # Requires ``anthropic-beta: fallback-credit-2026-07-01``; without that
      # header the field accepts the bare string only. The bare string and the
      # mode-less object are equivalent (both select ``strict``), so wrapping
      # an existing token changes nothing by itself.
      variant -> { Anthropic::Beta::BetaFallbackCreditTokenParam }

      variant String

      # @!method self.variants
      #   @return [Array(Anthropic::Models::Beta::BetaFallbackCreditTokenParam, String)]
    end

    # Determines whether to use priority capacity (if available) or standard capacity
    # for this request.
    #
    # Anthropic offers different levels of service for your API requests. See
    # [service-tiers](https://platform.claude.com/docs/en/api/service-tiers) for
    # details.
    #
    # @see Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params#service_tier
    module ServiceTier
      extend Anthropic::Internal::Type::Enum

      AUTO = :auto
      STANDARD_ONLY = :standard_only

      # @!method self.values
      #   @return [Array<Symbol>]
    end

    # The inference speed mode for this request. `"fast"` enables high
    # output-tokens-per-second inference.
    #
    # Some models require the `fast-mode-2026-02-01` beta header for any `speed`
    # value. See
    # [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) for
    # which models.
    #
    # @see Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params#speed
    module Speed
      extend Anthropic::Internal::Type::Enum

      STANDARD = :standard
      FAST = :fast

      # @!method self.values
      #   @return [Array<Symbol>]
    end

    # System prompt.
    #
    # A system prompt is a way of providing context and instructions to Claude, such
    # as specifying a particular goal or role. See our
    # [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
    #
    # @see Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params#system_
    module System
      extend Anthropic::Internal::Type::Union

      variant String

      variant -> { Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::System::BetaTextBlockParamArray }

      # @!method self.variants
      #   @return [Array(String, Array<Anthropic::Models::Beta::BetaTextBlockParam>)]

      # @type [Anthropic::Internal::Type::Converter]
      BetaTextBlockParamArray = Anthropic::Internal::Type::ArrayOf[-> {
        Anthropic::Beta::BetaTextBlockParam
      }]
    end
  end
end

Instance Attribute Details

#custom_id ⇒ String

Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.

Must be unique for each request within the Message Batch.

Parameters:

  • value (String)

Returns:

  • (String)


68
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 68

required :custom_id, String

#params ⇒ Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params

Messages API creation parameters for the individual request.

See the Messages API reference for full documentation on available parameters.

Parameters:

  • value (Anthropic::Beta::Messages::BatchCreateParams::Request::Params)

Returns:



78
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 78

required :params, -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params }

Instance Method Details

#to_hash ⇒ { custom_id: String, params: Anthropic::Beta::Messages::BatchCreateParams::Request::Params }

Returns:

  • ({ custom_id: String, params: Anthropic::Beta::Messages::BatchCreateParams::Request::Params })


66
67
68
69
# File 'sig/anthropic/models/beta/messages/batch_create_params.rbs', line 66

def to_hash: -> {
  custom_id: String,
  params: Anthropic::Beta::Messages::BatchCreateParams::Request::Params
}