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(pull : JSON::PullParser)
Sourcenew(model : String, max_tokens : Int32 | Nil = nil, output_config : OutputConfig | Nil = nil, speed : String | Nil = nil, thinking : ThinkingConfig | Nil = nil)
Sourcenew(*, __pull_for_json_serializable pull : JSON::PullParser)
SourceInstance methods
max_tokens
Sourcemodel
Sourceoutput_config
Sourcespeed
Sourcethinking
Source