struct

Anthropic::FallbackParam

Inherits JSON::Serializable < Struct < Value < Object

One entry in the top-level fallbacks: array on a message request.

Each entry names a model to try if the primary model refuses. The four override fields (max_tokens, output_config, speed, thinking) replace the top-level field for that attempt only.

Requires the server-side-fallback-2026-07-01 beta header (auto-attached when fallbacks: is set). The older server-side-fallback-2026-06-01 header is still accepted by the API.

message = client.beta.messages.create(
  model: Anthropic::Model::CLAUDE_FABLE_5,
  max_tokens: 1024,
  fallbacks: [
    Anthropic::FallbackParam.new(model: Anthropic::Model::CLAUDE_OPUS_4_8),
    Anthropic::FallbackParam.new(model: Anthropic::Model::CLAUDE_SONNET_5),
  ],
  messages: [{role: "user", content: "..."}]
)

# Or use the server-defined default chain for the primary model:
message = client.beta.messages.create(
  model: Anthropic::Model::CLAUDE_FABLE_5,
  max_tokens: 1024,
  fallbacks: "default",
  messages: [{role: "user", content: "..."}]
)

Constructors

new(model : String, max_tokens : Int32 | Nil = nil, output_config : OutputConfig | Nil = nil, speed : String | Nil = nil, thinking : ThinkingConfig | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

max_tokens
Source
model
Source
output_config
Source
speed
Source
thinking
Source