class RubyLLM::Batch

A Batch is a provider-side batch of chat completions: chats awaiting a response go in together, answers come back at batch prices, typically within hours. Persist the id, pick the batch back up from any process, and collect the messages once processing ends.

chats = documents.map do |doc|
  RubyLLM.chat(model: "claude-haiku-4-5").ask_later(doc.text)
end
batch = RubyLLM.batch(chats)
batch.id                # => "msgbatch_01EhcDuvb5XfWqcdJArbsfNX"
batch.refresh.complete? # => false, check back later
batch.messages          # the responses, in submission order